Friday, July 06, 2012

Matching a word / characters outside of html tags « Adventures in PHP / DHTML / CSS and MySQL

Matching a word / characters outside of html tags « Adventures in PHP / DHTML / CSS and MySQL:

'via Blog this'

Cut-n-pasted from there:


So in English, the regEx I came up with, word(?!([^<]+)?>), could be interpreted as:

Match the characters "word" literally word
Assert that it is impossible to match the regex below starting at this position (negative lookahead) (?!([^)
Match the regular expression below and capture its match into backreference number 1 ([^<]+)? Between zero and one times, as many times as possible, giving back as needed (greedy) ? Match any character that is not a "<" [^<]+ Between one and unlimited times, as many times as possible, giving back as needed (greedy) + Match the character ">" literally >

No comments: