Thread View: news.software.readers
3 messages
3 total messages
Started by wyzwyz
Wed, 14 Sep 2005 16:30
[dialog] word boundaries
Author: wyzwyz
Date: Wed, 14 Sep 2005 16:30
Date: Wed, 14 Sep 2005 16:30
11 lines
1229 bytes
1229 bytes
What's the difference between \W and \b ?
the following happens, when i run these filters
+1 subject {\Wabc\W}
+2 subject {\babc\b}
2 abc:
2 abc: test
2 test abc
3 test abc:
3 test abc: test
Re: [dialog] word boundaries
Author: Korbinian Abenthum
Date: Wed, 14 Sep 2005 19:05
Date: Wed, 14 Sep 2005 19:05
29 lines
2159 bytes
2159 bytes
wyzwyz wrote:
> What's the difference between \W and \b ?
Not exactly on topic, but anyway: Have a look into e.g.
http://www.regular-expressions.info/tutorial.html
\W represents a character that is not a word character,
i.e. neither alphanumeric nor the underscore
\b is a wordboundary, i.e. matches if on exactly one side of that marker
is a word character.
The main difference in your example is that \b matches at the beginning or
the end of the text, too, whereas \W needs a character to match. That's why
> +1 subject {\Wabc\W}
doesn't match
> 2 abc:
> 2 abc: test
> 2 test abc
HTH
--
"For that I thank you, but for nothing else. Kill me and be done with it.
You are no Lord of mine" (Rickard Karstark)
Re: [dialog] word boundaries
Author: Ted S.
Date: Wed, 14 Sep 2005 19:10
Date: Wed, 14 Sep 2005 19:10
23 lines
1649 bytes
1649 bytes
Somebody claiming to be wyzwyz <wyzwyz@wyz> wrote in news:43285033$0$12681$5a62ac22@per-qv1-newsreader-01.iinet.net.au: > What's the difference between \W and \b ? >From my copy of the Active Perl help (perlre): <snip> A word boundary (\b) is a spot between two characters that has a \w on one side of it and a \W on the other side of it (in either order), counting the imaginary characters off the beginning and end of the string as matching a \W. </snip> \b is listed under "zero-width assertions"; \W is most definitely *not* zero-width. -- Ted <fedya at bestweb dot net> Oh Marge, anyone can miss Canada, all tucked away down there.... --Homer Simpson
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads