Re: [opensuse] regexp -- defference between \< and \b ? (fwd)
On Wednesday 2008-04-30 15:53, Randall R Schulz wrote:
With regular expressions, what is the difference between \< and \b ? The man page says:
Which man page? ...
Actually it comes from man grep. Specifically:
The Backslash Character and Special Expressions The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word, ...
I guess it's been a long time since I've read the man page for the grep family. I didn't realize \b and \B were a part of Gnu grep.
PCRE does not seem to know \<, so \b is what you would want these days. \< and \> seem archaic, there does not seem to be a \<-based pattern that could not be expressed with \b. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 30 April 2008 23:59, Jan Engelhardt wrote:
On Wednesday 2008-04-30 15:53, Randall R Schulz wrote:
...
I guess it's been a long time since I've read the man page for the grep family. I didn't realize \b and \B were a part of Gnu grep.
PCRE does not seem to know \<, so \b is what you would want these days.
I know that. That's my lament.
\< and \> seem archaic, there does not seem to be a \<-based pattern that could not be expressed with \b.
The old style is more suggestive and if you care about directionality, they're a lot more concise. Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
----- Original Message ----- From: "Jan Engelhardt" <jengelh@computergmbh.de> To: <opensuse@opensuse.org> Sent: Thursday, May 01, 2008 2:59 AM Subject: Re: [opensuse] regexp -- defference between \< and \b ? (fwd)
On Wednesday 2008-04-30 15:53, Randall R Schulz wrote:
With regular expressions, what is the difference between \< and \b ? The man page says:
Which man page? ...
Actually it comes from man grep. Specifically:
The Backslash Character and Special Expressions The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word, ...
I guess it's been a long time since I've read the man page for the grep family. I didn't realize \b and \B were a part of Gnu grep.
PCRE does not seem to know \<, so \b is what you would want these days.
\< and \> seem archaic, there does not seem to be a \<-based pattern that could not be expressed with \b.
Isn't that like saying any line boundary is the same as begining of line? To me \< and \> are exactly as useful as ^ and $ Or is the argument that you get the same thing as , \< or \> naturally by where you place any further expression context in relation to \b? ie: \bstuff or \b.* automatically = \< and stuff\b or .*\b automatically = \> ? does that actually work out? Say if you wanted to match simply the begining of every word, or the beginning of the nth word after/before some other expression, etc.. but you don't know or care what the word itself is. -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Brian K. White
-
Jan Engelhardt
-
Randall R Schulz