in reply to Re: Backslashes in regular expressions
in thread Backslashes in regular expressions
my @split = split /(?<!\\)&/, $tosplit;
Ok, I can see that that will split on an ampersand without a backslash before it, how does it deal with the situation where you have a "backslashed" backslash at the end of one of the strings? i.e. the string to be split ends with two backslashes neither of which is intended to "backslash" the ampersand. I don't think your split works in all situations which is what I was attempting.
Actually I've had another look and come up with this:
Which seems to do what I wanted. I still don't know why/[^\\]\\(\\\\)*$/
doesn't work. Why is((\\)+\1)
Oh yes I also tried((\\)+\1)* not equivalent to (\\\\)*
but that didn't seem to work either.((\\)+\2)*
Am I missing somthing fundamental and blindingly obvious?
Thanks for taking the time to read my ramblings
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Backslashes in regular expressions
by perlmonkey (Hermit) on May 08, 2000 at 06:43 UTC | |
by nuance (Hermit) on May 08, 2000 at 14:03 UTC |