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 15
Title Test Details Validate MS DOS 8.3 Directory or File name (without extension)
Expression
[^ _0-9a-zA-Z\$\%\'\-\@\{\}\~\!\#\(\)\&\^]
Description
Use this regular expression to find any invalid characters within a DOS 8.3 Directory or Folder name. Reference: http://support.microsoft.com/?id=120138
Matches
one$two folder_name file@name
Non-Matches
one:two folder*name file:name
Author Rating: The rating for this expression. Charles Forsyth
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: Not yet rated. 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: Not yet rated. 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: Not yet rated. 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
Title Test Details Validate alpha-numeric international names (no double-spaces)
Expression
^([\u00c0-\u01ffa-zA-Z'\-]+[ ]?[\u00c0-\u01ffa-zA-Z'\-]*)+$
Description
Validate alpha-numeric international names with no more than one space between them
Matches
Tom Jones, Liam Le'Brok, Joesh Ölensky
Non-Matches
Tom Jones (two spaces), Jo#, E-L33T
Author Rating: Not yet rated. Charles Forsyth
Title Test Details Test invalid characters - allow alpha numeric including accent characters
Expression
[a-zA-Z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u01FF]
Description
This regex is used to test if a word contains alpha-numeric characters, including accent characters
Matches
a b c d 1 2 3 Ö ö É
Non-Matches
# _ @ ç ²
Author Rating: Not yet rated. Charles Forsyth
Title Test Details ISO8601 Date Parser v2
Expression
^(\d{4})(?:-([0]\d|[1][0-2]))(?:-([0-2]\d|[3][01]))(?:T([01]\d|2[0-3]))(?::([0-5]\d))(?::([0-5]\d)(?:\.(\d{1,7}?)|)|)(Z|([+-])([01]\d|2[0-3])(?::([0-5]\d)))$
Description
Good for JavaScript. Parses an ISO8601 Date into separate Date() object parts, so you can set a Date object by passing in an ISO8601 string. NOTE: Will not match illegal dates such as the 32nd day of a month or the 61st minute of an hour, etc. Use like this: if (regexFull.test(dString)) { matches = dString.toString().match(regexFull); offset = 0; date.setUTCDate(1); date.setUTCFullYear(parseInt(matches[1],10)); date.setUTCMonth(parseInt(matches[2],10) - 1); date.setUTCDate(parseInt(matches[3],10)); date.setUTCHours(parseInt(matches[4],10)); date.setUTCMinutes(parseInt(matches[5],10)); if (matches[6]) { date.setUTCSeconds(parseInt(matches[6],10)); } if (matches[7]) { date.setUTCMilliseconds(parseInt(matches[7])); } if (matches[8] != 'Z') { offset = (matches[10] * 60) + parseInt(matches[11],10); offset *= ((matches[9] == '-') ? -1 : 1); date.setTime(date.getTime() - offset * 60 * 1000); } }
Matches
2013-12-01T04:33Z, 2013-12-01T04:33:12.234Z, 2013-12-01T23:12-07:00
Non-Matches
2013, 2013-12, 2013-12-01, 2013-99-99T99:99Z
Author Rating: The rating for this expression. Charles Forsyth
   Displaying page 1 of 1 pages; Items 1 to 15

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