View Full Version : Regex question

12-07-2010, 09:16 PM
Is there any way, with a regex, to capture a pattern and use that match within the regex itself? Something along the lines of:

~(one|two|three)some other text here(this part here should match the captured pattern, rather than just specifying one|two|three again)~

Cheers muchly.

12-07-2010, 09:26 PM
What you're looking for is a back reference:

~(one|two|three)some other text here\1~

12-07-2010, 09:58 PM
Cheers. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum