|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Answer: How do i find $a and replace it with $b when it's preceded by $c? |
| ( #17945=categorized answer: print w/ replies, xml ) | Need Help?? |
|
Q&A > regular expressions > How do i find $a and replace it with $b when it's preceded by $c? contributed by btrott
<Editor's Note:>
Here is chromatic's post to which btrott is responding. I prefer a simpler approach: Am I missing anything the lookbehind provides? </Editor's Note> All right... here's a benchmark of the two methods (lookbehind and just straight substitution). It looks like lookbehind is slightly faster, but not by a huge lot. Here's the code: And here are the benchmark results:
|
|
||||||||||||||||||