spx2 has asked for the wisdom of the Perl Monks concerning the following question:
also i have one more question, if i put in $pattern="has" i get the text splitted at the word "has" but if i do $pattern="(has|big)" i expect it to be splitted at words "has" and "big" but it doesnt work at all. thank youmy $text="jojo,has|some:big>balls][nuts,sometimes_|_he,scratches"; my $pattern= "(,|\||:|>|][|_\|_)"; my @splitted= split /\Q$pattern/,$text; foreach $particle (@splitted) { print $particle."\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex trouble
by trwww (Priest) on May 30, 2007 at 07:28 UTC | |
by dewey (Pilgrim) on May 30, 2007 at 16:43 UTC | |
by graff (Chancellor) on May 31, 2007 at 03:32 UTC | |
by dewey (Pilgrim) on May 31, 2007 at 14:37 UTC | |
|
Re: regex trouble
by GrandFather (Saint) on May 30, 2007 at 07:08 UTC | |
by blazar (Canon) on May 30, 2007 at 11:49 UTC | |
by GrandFather (Saint) on May 30, 2007 at 20:43 UTC | |
|
Re: regex trouble
by dewey (Pilgrim) on May 30, 2007 at 07:16 UTC |