A regular expression to replace all ampersands (&) in a text that are not part of an entity:
t = t.gsub(/&(?!#?\w+;)/, '&') |
Language is ruby. The regexp feature used is called a negative lookahead.
May 25, 2008 by Michael
A regular expression to replace all ampersands (&) in a text that are not part of an entity:
t = t.gsub(/&(?!#?\w+;)/, '&') |
t = t.gsub(/&(?!#?\w+;)/, '&')
Language is ruby. The regexp feature used is called a negative lookahead.
No comments yet
Post a Comment