in reply to Re: strip text from a string
in thread strip text from a string
s/(\s*'[^']*?')//g;
I'm not sure why you enclose the pattern in parentheses as I don't think a capture is required. Also, you don't need the non-greedy quantifier when using negated character classes, that's the whole point of using them as it means you can avoid the commonly seen .*? pattern.
I hope this is of interest.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: strip text from a string
by Athanasius (Archbishop) on Sep 11, 2014 at 15:45 UTC | |
|
Re^3: strip text from a string
by KalaMonkey (Initiate) on Sep 11, 2014 at 15:31 UTC |