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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find XML Injection Regex
Expression
([a-zA-Z0-9\\-\\$\\s\\.#@%^*(){}|:;,?+=/]*[<>'\"!&\\[\\]]+((\\s|)CDATA(\\s|))*[a-zA-Z0-9<>'\"!&\\[\\]\\-\\$\\s\\.#@%^*(){}|:;,?+=/]*)+
Description
This regex will detect XML Injection in the input built around CDATA. So if the input is something like, <![CDATA[ / ]]> - this regex will detect and return true
Matches
<![CDATA[ / ]]> | a<![CDATA[ / ]]> | a <![CDATA[ / ]]> | ]]> | <![CDATA[/]]> | 1<![CDATA[ / ]]> | abc<![CDATA[ / ]]> | 123<![CDATA[ / ]]> | 123 <![CDATA[ / ]]> | <![CDATA[<script>alert('hi');</script>]]> | <![CDATA[a]]> | A<![CDATA[ / ]]> | A <![CDATA[ / ]]> | ABC<![CDATA[ / ]]> | ABC <![CDATA[ / ]]> | ABC123<![CDATA[ / ]]> | ABC123 <![CDATA[ / ]]> | ABC123 <![CDATA[123]]> | <![CDATA[ / ]]>13 | FABC-FIXED-25<![CDATA[ / ]]> | <![CDATA[ / ]]>ABC-FIXED-25 | ';dfsdfd | ] CDATA ! | < ! [ CDATA [ / ] ] > | TEST CENTER 30/7 ]]> | ]]>asd=ads | ]]>CITY TEST MAX 30=7 TEST
Non-Matches
asd | 123 | 1000000.1 | asd asd | ASD ASD ASD ASD ASD | 123 123 123 ASD 123 | 123.33 | asd=ads
Author Rating: The rating for this expression. Sakthi Sivram
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

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