|
|
| There's more than one way to do things | |
| PerlMonks |
Answer: How do I find the Nth occurrence of a pattern? |
| ( #2151=categorized answer: print w/ replies, xml ) | Need Help?? |
|
Q&A > regular expressions > How do I find the Nth occurrence of a pattern? contributed by vroom
Use the /g (global) to find all occurrences in a string. Place the matching statement within a while loop and count until you get to the wanted number.
|
|
||||||||||||||||||