[Top][All Lists]

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

Re: [Bug-ed] Searching for multiple matches with \+ isn't working

From: John Cowan
Subject: Re: [Bug-ed] Searching for multiple matches with \+ isn't working
Date: Wed, 2 Jan 2019 17:21:37 -0500

Info ed is the source of the statement that what regex things work depends on the regex package ed was built with.  Jump down to COMMANDS and it's right above that, the last paragraph in the REGULAR EXPRESSIONS section.

The link to the Posix standard is the source of the statement that \+ etc. are not defined in Posix basic REs.

On Wed, Jan 2, 2019 at 4:40 PM Brian Zwahr <address@hidden> wrote:
Thanks for the response. I didn't realize any of that. The GNU ed manual makes no mention of that on the Regular Expressions page. It just lists \+ as valid. Does the manual need to be updated to include this information? Additionally, I've checked `info ed` and I don't see anything about extensions or only having access to things like \+ conditionally based upon how ed was compiled or installed. Am I just not seeing it in the info? Which page is it on?


On Wed, Jan 2, 2019, at 3:07 PM, John Cowan wrote:
> ed uses Posix basic REs, and the use of \+ in basic REs to get the effect of + in extended REs is a non-Posix extension.  See <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_05_01>, where there is no mention of \+ except its use in extended REs.  The same is true of escaped ?, (, ), |, {.
> The `info ed` command documents that exactly which regular _expression_ characters work depends on the regex package with which ed was built.
> -- 
> John Cowan          http://vrici.lojban.org/~cowan        address@hidden
> He made the Legislature meet at one-horse tank-towns out in the alfalfa
> belt, so that hardly nobody could get there and most of the leaders
> would stay home and let him go to work and do things as he pleased.
>     --H.L. Mencken's translation of the Declaration of Independence
> On Wed, Jan 2, 2019 at 3:52 PM Brian Zwahr <address@hidden> wrote:
>> I'm having an issue where using \+ to search for multiple matches isn't working. Am I doing something wrong?
>>  I have GNU ed 1.14.2 installed on the latest macOS through Homebrew (https://brew.sh). Homebrew installed the executable as ged instead of ed, to not overtake the BSD ed that ships with macOS. I mention this so you understand why the command I'm running is ged instead of ed.
>>  I see that 1.15 is in pre-release, but I don't see this issue addressed in the changelogs I'm seeing in the archives of this list.
>>  Here are steps to reproduce:
>>  $ ged -v
>>  # Let's add a couple of lines.
>>  a
>>  foobar
>>  bazfoo
>>  .
>>  # Great! Now, let's search for "o".
>>  g/o/
>>  foobar
>>  bazfoo
>>  # Both lines match. Perfect. Now, let's search for multiple "o"s.
>>  g/o\+/
>>  # Not found? :-(
>>  q
>>  ?
>>  Warning: buffer modified
>>  q
>>  Proof of version:
>>  $ ged -V
>>  GNU ed 1.14.2
>>  Copyright (C) 1994 Andrew L. Moore.
>>  Copyright (C) 2017 Antonio Diaz Diaz.
>>  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>>  This is free software: you are free to change and redistribute it.
>>  There is NO WARRANTY, to the extent permitted by law.
>>  _______________________________________________
>>  bug-ed mailing list
>>  address@hidden
>>  https://lists.gnu.org/mailman/listinfo/bug-ed

reply via email to

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