in reply to Re: Randomly regex substitute
in thread Randomly regex substitute

Just curious, what if instead of replacing ONE boy, we are going to replace N boys? substr will definitely fail if the replacement string is of a different length?

Replies are listed 'Best First'.
Re^3: Randomly regex substitute
by Jim (Curate) on Dec 24, 2010 at 07:52 UTC

    You replied to my post, but I think you intended to ask someone else this question — someone who used substr in his or her solution.

    My solution works with any arbitrary regular expression pattern and any arbitrary replacement string. I think my solution is the one most likely to earn the OP an A+.