in reply to Re: Another puzzled RegEx Problem.
in thread Another puzzled RegEx Problem.
No external loop, no reverse and nothing but "-" in the substitution part:
$d =~ s/(?!^|$)(?(?{ pos() % 2 })(?!))/-/g;
Update: Bug fix. I originally forgot to prevent "-" from being placed at the end.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Another puzzled RegEx Problem.
by pysome (Scribe) on Sep 13, 2007 at 01:11 UTC |