Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
((?:\<[^<>]+\>\s?)?)([:]\w+(?!\w*[;]))((?:\s?\<\/[^<>]+\>)?)((?:(?:.(?!\1\2\3))*.){2})\1\2\3
/

Description

This regex replace the second tag content which has the prefix ":". If you want to replace the third, just increase the statement {1} to {2}, and so go on.

Submitted by Caio Oliveira - 11 years ago