code_junkie

Regex: Do not match if pattern at the end of the string

Nov 13th, 2011
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. <b> <i> <u> </b> </i> </u>
  2.  
  3. string = Regex.Replace(string, ".((<[/biu]+>)+)", ".$1||")
  4.  
  5. This <b>should match.</b> allright.
  6.  
  7. This <i><b>shouldn't match.</b></i>
  8.  
  9. ".((<[/biu]+>)+)(?!$)"
  10.  
  11. .(?>(?:</?[biu]>)+)(?!$)
  12.  
  13. ".((<[/biu]+>)+)[^<>]+"
Add Comment
Please, Sign In to add comment