Thursday, April 28, 2016

Re: RFE: support POSIX standard and developing RE's

On 27 April 2016, Linda W <vim@tlinx.org> wrote:
[...]
> BRE's are compatible with ERE's. If you *only* use BRE syntax, then
> any prog using ERE's "should" still work the same for you.

Right, I suppose I should have stopped reading here. :) I didn't
(against my better), presumably because:

[...]
> And you are an aggressive nerdbutt!

Thank you for noticing. It might be wise to keep that in mind for
the purpose of further interactions. :)

On 27 April 2016, Linda W <vim@tlinx.org> wrote:
> LCD 47 wrote:
[...]
> > Actually, try something simpler:
> >
> > $ grep --version
> > grep (GNU grep) 2.24
> > Copyright (C) 2016 Free Software Foundation, Inc.
> > 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.
> >
> > Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
> >
> > $ echo 'foo bar' | egrep -o '[[:<:]]bar'
> > grep: Invalid character class name
> >
> What is [[:<:]]? What standard is it a part of? Never seen it before.
> Um:
> perl -we 'use strict; use P;
> > my $a="now < there";
> > $a =~ /[[:<:]] there/;
> > '
> POSIX class [:<:] unknown in regex; marked by <-- HERE in m/[[:<:] <--
> HERE ] there/ at -e line 3.
> ----
> Oh, You made up your own syntax!

I didn't, honestly. I didn't have to either, BSD came up with it
first:

http://man.openbsd.org/re_format.7
https://www.freebsd.org/cgi/man.cgi?query=re_format&sektion=7
http://netbsd.gw.com/cgi-bin/man-cgi?re_format+7+NetBSD-current

> I see. It's not part of any standard.

I could have sworn it was part of POSIX.1, and OpenBSD's
re_format(7) also seemed to imply that it is:

http://man.openbsd.org/re_format.7

Other people seem to believe the same:

http://www.regular-expressions.info/refwordboundaries.html

But I couldn't confirm that with the standard:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html

-- and NetBSD's re_format(7) actually notes that [:<:] and [:>:] are
extensions:

http://netbsd.gw.com/cgi-bin/man-cgi?re_format+7+NetBSD-current

So you're right, it isn't part of POSIX. My bad, I should have
digged deeper, sorry about that. Regardless, It might still make a
worthy crussade for you BRE slayers to fight: unification of grep(1)
syntax across the various UNIX platforms. Then turn to sed(1) next.
They are in even wider used than Vim. :)

[...]
> > As for Vim: its regexes have features not present in any other
> > language.
> Such as?
[...]

An example that comes to mind is \ze.

The other end of this ship seems to have sailed some two weeks ago,
so I won't waste your time with re-hashing old arguments.

/lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: