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

Please support RegExLib Sponsors

Hosting Spotlight

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 12
Title Test Details Validate very strong password
Expression
^(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[a-z])(?=.*[A-Z])(?i-msnx:(?!.*pass|.*password|.*word|.*god|.*\s))(?!^.*\n).*$
Description
This regular expression can be used to validate a strong password. It will evaluate to true if the following critera are met: Must be 8 characters in length total. Must contain at least 1 digit. Must contain at least 1 lower case letter. Must contain at least 1 upper case letter. Must contain at least 1 non-character (such as !,#,%,@, etc). Must not contain the words "password" or "pass" or "word" or "god" Must not contain a whitespace. Note: This version is not compatible with JavaScript
Matches
one2!fouR, @Eight21, one22Four%, 2thRee@four, 7diPity*, 12345aB(
Non-Matches
one2three!, four2345, #viced@#$, short1@
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Strip HTML tags with exceptions
Expression
<\/*?(?![^>]*?\b(?:a|img)\b)[^>]*?>
Description
This regex will match all HTML tags except 'a' tags or 'img' tags. You can edit the list of exclusions as you see fit. I use this regex to strip all HTML tags from source data except anchor tags and image tags.
Matches
<script> </html> <anytag>
Non-Matches
<a> <img /> </a>
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Strip HTML tags and content between
Expression
<(script|style)[^>]*?>(?:.|\n)*?</\s*\1\s*>
Description
This regular expression will match only <script> and <style> tags and all content between them. Use this with regex.replace to strip script blocks and style blocks from HTML source.
Matches
<script>test</script>, <style>test<style>
Non-Matches
-all other html code is ignored-
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Parse quoted phrases and single words for searching
Expression
(?<=(?:^|\s|,)")[^"]*?(?=")|(?<=\s|^)(?!")[\w\W]+?(?=\s|$)
Description
RegEx will match phrases in double-quotes or words separated by spaces. It excludes the double-quotes from matches
Matches
first any quoted phrases, second any word separated by spaces
Non-Matches
n/a
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Validate password has at least 4 non-alphanumeric characters within it
Expression
^(?=.*(\W.*){4,}).*$
Description
This RegEx will validate a password that has at least 4 non-alphanumeric characters in it. The characters do not need to be adjacent.
Matches
test$#%! t#e!s%t& #$test!@ %te#@st#!
Non-Matches
test#$% %test#@ @t%e#st @test te%!st
Author Rating: Not yet rated. Charles Forsyth
Title Test Details Replace spaces with " AND " for Full Text query
Expression
(?<!and\snot|and|not|or)\s+(?!(and\snot|or|-)|([^"]*"[^"]*")*[^"]*"[^"]*$)
Description
This regular expression is used to replace all spaces between words that are not within quotes or already next to AND|OR|AND NOT
Matches
The space between "one two" is found unless it appears inside doulbe quotes
Non-Matches
The spaces between "one and two" are ignored
Author Rating: Not yet rated. Charles Forsyth
Title Test Details Find words or phrases
Expression
\"[^"]+\"|\([^)]+\)|[^\"\s\()]+
Description
RegEx parses out all whole words, phrases within quotes or parentheses.
Matches
one, two, three, "four five", (six seven)
Non-Matches
"four, five", (six, seven)
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Match words not in quotes or are AND OR NOT
Expression
(?!\bnot\b|\band\b|\bor\b|\b\"[^"]+\"\b)((?<=\s|\-|\(|^)[^\"\s\()]+(?=\s|\*|\)|$))
Description
This regex will match all words in a search term entered by a user. This ignores words within double quotes and also ignores the words "AND" "OR" or "NOT". I use this to add double quotes around each word for full text query building.
Matches
pear, apple, ban*, -notword
Non-Matches
"words withinin quotes", not, and, or
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Parse ISO8601 Dates into parts
Expression
(\d\d\d\d)-?(\d\d)-?(\d\d)T?(\d\d):?(\d\d)(?::?(\d\d)(\.\d+)*?)?(Z|[+-])(?:(\d\d):?(\d\d))?
Description
This regular expression will parse an ISO8601 date into it's individual parts.
Matches
2009-06-18T18:50:57-06:00, 2009-06-18T18:30:01.123478-06:00, 2009-06-18T18:30:45Z, 2009-06-18T18:39Z
Non-Matches
January 5, 1995, or other non ISO8601 dates.
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Validate GUID
Expression
((^[{])|^)[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}(?(2)[}]$|$)
Description
This regex will validate a GUID. If the GUID starts with an opening curly bracket, then it must also end in a closing curly bracket. If it does not start with one, then it must not end with one.
Matches
778ed84f-2f9c-42b5-b314-4d0e0cde8422, {778ed84f-2f9c-42b5-b314-4d0e0cde8422}
Non-Matches
{778ed84f-2f9c-42b5-b314-4d0e0cde8422, 778ed84f-2f9c-42b5-b314-4d0e0cde8422}, 234l3, 23423525w
Author Rating: Not yet rated. Charles Forsyth
Title Test Details Valid GUID (VBScript)
Expression
^[{][A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}[}]$|^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$
Description
This RegEx validates a GUID number with or without curly brackets. But requires both brackets if any is provided. This version is compatible with VBScript's RegEx engine
Matches
778ed84f-2f9c-42b5-b314-4d0e0cde8422, {778ed84f-2f9c-42b5-b314-4d0e0cde8422}
Non-Matches
778ed84f-2f9c-42b5-b314-4d0e0cde8422}, {778ed84f-2f9c-42b5-b314-4d0e0cde8422
Author Rating: Not yet rated. Charles Forsyth
   Displaying page 1 of 1 pages; Items 1 to 12

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