[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Structural regular expressions

From: Stefan Monnier
Subject: Re: Structural regular expressions
Date: Sun, 12 Sep 2010 15:48:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> Thanks for the explanation.  I think the term "structural regular
> expressions" is misleading because its grammatical construction
> implies a different kind of regexp, rather than a different way of
> applying them.

>     V/pattern  select all matches
>     V|pattern  select all lines with match
>     V{scope    select all matching scopes
>     Vatype     select all objects (inclusive)
>     Vttype     select all objects (exclusive)
>     Y/pattern  select everything but matches
>     Y|pattern  select all lines without match
>     Y{scope    select everything but scope
>     Yatype     select everything but objects (inclusive)
>     Yttype     select everything but objects (exclusive)

> Are `V/' etc. literal, or do they stand for some other text?

> Where would this syntax be used?

The term "structural regular expression" is indeed misleading, I think.
They use it to refer to the combination of 2 things:
1- the ability to select particular kinds of elements in the text
   (which we could do in Emacs with non-contiguous regions).  The main
   example being commands that select "all the strings" or "all the
   comments" or that inverts the selection (select everything that
   wasn't selected before).
2- the ability to apply regexp-operations to only those selected parts
   of the text (to the extent that we already have commands that apply
   only to the active region, we already have that, although it would
   probably require several tweaks to make it work right in the face of
   non-contiguous regions).

Together this allows you to do things like apply query-replace to all
non-string non-comment parts of the buffer, which is why they call it
"structural" regexps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]