JimJ has asked for the wisdom of the Perl Monks concerning the following question:
while ( $rec =~ /\b\w+\b/g ) { $word = $&; }
That works well except I don't want it to define a word break as a slash ("/"). This is because a lot of words are notations like: "a/c", "4-5/16", etc. What I'd like to do is redefine what "\b" is. I know that is not possible, but I'm trying to figure out a technique that would let be create something like the "\b" asserion only something I could define. For example, I want to break a word at space, comma, periord, but not slash.
Also, what characters does the "\b" assertion encompass? Is it any character that is not alpha, digit or underscore?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re-define Word Boundary?
by sauoq (Abbot) on Nov 20, 2003 at 23:20 UTC | |
|
Re: Re-define Word Boundary?
by davido (Cardinal) on Nov 20, 2003 at 23:11 UTC | |
|
Re: Re-define Word Boundary?
by Abigail-II (Bishop) on Nov 20, 2003 at 23:32 UTC | |
by ysth (Canon) on Nov 21, 2003 at 01:05 UTC | |
|
Re: Re-define Word Boundary?
by thelenm (Vicar) on Nov 20, 2003 at 23:27 UTC | |
|
Re: Re-define Word Boundary?
by thospel (Hermit) on Nov 21, 2003 at 03:55 UTC | |
|
Re: Re-define Word Boundary?
by fletcher_the_dog (Friar) on Nov 21, 2003 at 16:16 UTC | |
|
use overload qr
by ambrus (Abbot) on Nov 21, 2003 at 19:17 UTC | |
by diotalevi (Canon) on Nov 22, 2003 at 02:39 UTC |