Subject: bug#41006: 26.3; regular expressions documentation

From: jan <[email-masked]>
Date: Tue, 5 May 2020 11:05:25 +0100

Hi all,
I know this was addressed at Stephan but I'm getting increasingly
puzzled by the difference between what other people are describing and
what I'm seeing.
 In the other e-mail Mr Stallman said he could see this:

* Regexp Special::      Special characters in regular expressions.
* Char Classes::        Character classes used in regular expressions.
* Regexp Backslash::    Backslash-sequences in regular expressions.

My emacs (Windows, 26.3) shows

* Regexp Search::             Search for match for a regexp.
* Regexps::                   Syntax of regular expressions.
* Regexp Backslash::          Regular expression constructs starting with ‘\’.
* Regexp Example::            A complex regular expression explained.

I started up my ubuntu machine and try to look in the manual to see if
it was different from the windows, FYI I got "Info file emacs does not
exist".

OK... it finally twigged. I've just looked elsewhere. From the emacs menu:
'Search Documentation' submenu 'Look Up Subject In Elisp Manual'

Enter:
regexp RET

Click 'Syntax Of Regexps' gets you to:

"34.3.1 Syntax of Regular Expressions" which looks like what Mr
Stallman has been describing

and finally I can see what Eli has described:

"
‘\{M,N\}’
     is a more general postfix operator that specifies repetition with a
     minimum of M repeats and a maximum of N repeats.  If M is omitted,
     the minimum is 0; if N is omitted, there is no maximum.  For both
     forms, M and N, if specified, may be no larger than 2**15 - 1 .

     For example, ‘c[ad]\{1,2\}r’ matches the strings ‘car’, ‘cdr’,
     ‘caar’, ‘cadr’, ‘cdar’, and ‘cddr’, and nothing else.
     ‘\{0,1\}’ or ‘\{,1\}’ is equivalent to ‘?’.
     ‘\{0,\}’ or ‘\{,\}’ is equivalent to ‘*’.
     ‘\{1,\}’ is equivalent to ‘+’.
"

Now compare this to what's in the user manual (not the Elisp manual):

"
‘\{N,M\}’
     is a postfix operator specifying between N and M repetitions—that
     is, the preceding regular expression must match at least N times,
     but no more than M times.  If M is omitted, then there is no upper
     limit, but the preceding regular expression must match at least N
     times.
     ‘\{0,1\}’ is equivalent to ‘?’.
     ‘\{0,\}’ is equivalent to ‘*’.
     ‘\{1,\}’ is equivalent to ‘+’.
"
The user manual doesn't state that the {,x} syntax is valid where the
Elisp manual does.

thanks

jan

On 05/05/2020, Richard Stallman <[email-masked]> wrote:
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > So I go to the "Regular Expressions" node, looking mostly for how to
>   > use them.  But I find nothing on that there.  I only find a review of
>   > what looks like everything I already knew about regular expressions.
>
> What I see in master is this structure.
> Is this different from what you saw?
> Does this structure eliminate the problem you had?
>
>
> @node Regular Expressions
> @section Regular Expressions
> @cindex regular expression
> @cindex regexp
>
> ...
>
> @menu
> * Syntax of Regexps::       Rules for writing regular expressions.
> * Regexp Example::          Illustrates regular expression syntax.
> @ifnottex
> * Rx Notation::             An alternative, structured regexp notation.
> @end ifnottex
> * Regexp Functions::        Functions for operating on regular expressions.
> @end menu
>
> --
> Dr Richard Stallman
> Chief GNUisance of the GNU Project (https://gnu.org)
> Founder, Free Software Foundation (https://fsf.org)
> Internet Hall-of-Famer (https://internethalloffame.org)
>
>
>