dewey has asked for the wisdom of the Perl Monks concerning the following question:
should split intothis is (some more) JOY code
I thought I had a good solution: split on whitespace when we can look behind for a ) and ahead for a (."this", "is", "(some more)", "JOY", "code"
but when I run this, I get "Variable length lookbehind is not implemented in regex".# match when between unescaped reverse parens + # ..or start/end of string + @script = split / (?<= #lookbehind (only remove whitespaces) + (^| #for start of string or + (?<!\\) \) ) #unescaped rparen followed by + .*? #stingy other chars + ) \s+ #some spaces, to be removed + (?= #lookahead + .*? #stingy other chars + ($| #end of string or + (?<!\\) \( ) #unescaped lparen + ) /xs, $script;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting on unusual regex
by BrowserUk (Patriarch) on May 14, 2007 at 03:24 UTC | |
by dewey (Pilgrim) on May 14, 2007 at 04:24 UTC | |
by BrowserUk (Patriarch) on May 14, 2007 at 06:58 UTC | |
by dewey (Pilgrim) on May 14, 2007 at 08:45 UTC | |
|
Re: Splitting on unusual regex
by naikonta (Curate) on May 14, 2007 at 02:44 UTC | |
by dewey (Pilgrim) on May 14, 2007 at 04:25 UTC |