RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Remove broken HEX and HTML entities
Expression
/&(?!\w+;|#\d+;)\S*/g
Description
Removes invalid or broken HEX and HTML entities from string. These will not be matched since they are valid: € € These will be matched since they are invalid entities: & &eu &; &# &#83 Especially handy in case a string is being manipulated using e.g. substring, which may break entities in either the beginning or end of the string. One might consider using ^ and $ to make it match only beginning and/or end of string. http://regex101.com/r/pM9dE5/16
Matches
& | &eu | &; | &# | &#83
Non-Matches
€ | €
Author Rating: Not yet rated. Jimmy
Source http://regex101.com/r/pM9dE5/16
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials