John W. Krahn wrote at Mon, 15 Jul 2002 15:16:38 +0200:
> Janek Schleicher wrote:
>>
>> John W. Krahn wrote at Sun, 14 Jul 2002 13:45:19 +0200:
>> >
>> > my @tokens = split /({\\[^\s}{]+|\\[^\s\\}]+|\\[\\}]|})/, $line;
>> > ^^ ^^ ^^
>>
>> Perhaps we can simplify even this regex:
>>
>> my @tokens = split / ( \\ (?: [^\s{}]+ |
> ^
> {
>
> You are missing the leading brace. Look at the pattern a little more carefully.
>
Now I know,
why I wrote "Perhaps" :-(
Again, perhaps, there's still a way to simplify ...
my @tokens = split / ( { \\ [^\s{}]+
| (?: \\ [^\s\\}]+ |
[\\}])
| }
)/x
=> $line;
or with a look a head trick:
my @tokens = split / (?=[\\{}])
( { \\ [^\s{}]+
| (?: \\ [^\s\\}]+ |
[\\}])
| }
)/x
=> $line;
Cheerio,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]