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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Get XML tag from string
Expression
<\?xml.*</note>
Description
This will find any XML within a string starting with the <?xml header and ending with the closing root tag. Replace </note> with your closing root tag. (use singleline and case insensitive) - I use this to pull xml written in a web document.
Matches
<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
Non-Matches
<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></BADnote>
Author Rating: The rating for this expression. Denny Love
Title Test Details Detect Javascript
Expression
<script.*/*>|</script>|<[a-zA-Z][^>]*=['"]+javascript:\w+.*['"]+>|<\w+[^>]*\son\w+=.*[ /]*>
Description
Matches any opening or closing script tags, inline javascript: tags, inline on<function> (ex: onClick) tags. MATCHES: <a href="javascript:alert('test0');"> <a href='javascript:alert("test1");'> <a href="#" onClick="alert('test2');" /> <script language="javascript" src="somewhere.js"> <script language="javascript" src="somewhere.js" /> <script> </script>
Matches
<a href="javascript:alert('test0');"> or <a href="#" onClick="alert('test');" /> etc...
Non-Matches
This should not appear because in javascript: you can use the < operator or the > operator.
Author Rating: Not yet rated. Denny Love
   Displaying page 1 of 1 pages; Items 1 to 2

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