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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
&(?![a-zA-Z]{2,6};|#[0-9]{3};)
Description
The goal of this regular expression is to replace all & (ampersand) characters by & if they are not the start of HTML entities. I used http://www.w3schools.com/html/html_entitiesref.asp as a reference. You can then use RegExp Replace method to do the work. Was helpful for me, might helpful be for you...
Matches
&ThisIsTooLong; | Lilo & Stich | &l;
Non-Matches
< | ¦ | ¦
Author Rating: Not yet rated. Frederick Samson
Source
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

Title: Very good
Name: Runnerdave
Date: 12/21/2005 7:48:33 PM
Comment:
simple and does the job I am using php so if anyone needs it there just remember to put the delimiters like: function valid_querystring($in_string){ $in_string = preg_replace("/&(?![a-zA-Z]{2,6};|#[0-9]{3};)/", "&", $in_string); return $in_string; }


Title: Correction for longer decimal entities
Name: Chris Kampmeier
Date: 7/10/2004 12:13:23 AM
Comment:
&(?![a-zA-Z]{2,6};|#[0-9]{3,5};)


Title: Too strict
Name: Critic
Date: 6/8/2004 1:16:29 PM
Comment:
This expression is a bit too strict: ε should be valid (Length=7) 〹 should be valid (Unicode) 邯 should be valid (Hexadecimal notation)


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