in reply to Simple regex question
But that may replace a question mark at the end of a string (or beginning). If you don't want that:s/(\s\?|\?\s)|\?/$1 || "'"/eg; # Look ma, no look behind/ahead
I am assuming that with "space", you mean any whitespace. If you really mean just a space (and not tabs, newlines, etc), replace \s with a space, and \S with [^ ].1 while s/(\S)\?(\S)/$1'$2/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple regex question
by AnomalousMonk (Archbishop) on Sep 15, 2010 at 18:24 UTC | |
by JavaFan (Canon) on Sep 15, 2010 at 21:18 UTC | |
by AnomalousMonk (Archbishop) on Sep 16, 2010 at 02:05 UTC |