The "normal" way to do this is with two substitutions
Ive often pondered on an optimisation of $s=~s/^\s+|\s+$/g so that this is no longer true. So far its been over my head in the sense of requiring too much research time to implement compared to other useful tasks that I can do, but maybe one day...
And for people wondering why this isn't the recommended way, its because this pattern will try to match every point in the string. The regex engine isnt currently smart enough to optimise this to only try the pattern twice.
In reply to Re^2: performance enhancement
by demerphq
in thread performance enhancement
by alandev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |