This node is inspired by the following (excerpt from the) comment by BrowserUk in Re: Re: Re: looking for a regex
s_\{.*?\}_{$sub[$n++]}_g;I'm not at all sure about using _ as the delimiter, but everything else I tried was altogether too messy.
Assuming that the traditional '/' is not available, I would have written that as one of the following
# For the sake of the discussion lets ignore the fact the # curlies didnt need to be escaped. s!{.*?}!{$sub[$n++]}!g; s:{.*?}:{$sub[$n++]}:g;
And I certainly wouldn't have done what I know is popular amongst some monks
s#{.*?}#{$sub[$n++]}#g;
Because I find it makes the code hard to understand at a glance, especially in an editor that doesnt know that the # in this context isnt a comment begin marker.
So what are the monks at large opinion on this ever so trivial a subject? Which alternate regex delimiter do you favour? And what are the arguments behind your opinion (if any)?
In reply to Whats your favorite nonstandard regex quote char? by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |