Welcome To Snipplr
Everyone's Recent Regular Expression Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
search for anything in-between two <TAG>'s and then replace the found string into the PHP if/else staement. $1 is wher TextMate stores the found string. (see http://screenflicker.com/mike/code/textmate-regex-replace/)
3
1243
posted 14 years ago by rwczippy
PCRE that matches any kind of YouTube URL and catches its video ID. It supports three kinds of URL: the classic (?v=), the AJAXed one (#!v=) and the short version (youtu.be). It also supports international URLs.
Tested with Javascript and PHP.
1
1755
posted 14 years ago by nkm
There are multiple ways of checking email adresses about their validity. This script is based on RFC 2822.
Please note that based on RFC 2822 [email protected] is considered valid.
The second snippet is the one I prefer, which only accepts T...
2
1777
posted 15 years ago by pacey
will split the string
"I am" search words
into
[0] => I am
[1] => searching
[2] => words
1
940
posted 15 years ago by svenito
Matches are as follows:
0 = protocol
1 = fqdn
2 = subdomain
3 = top level subdomain
4 = domain (blah.com)
5 = port
6 = path
7 = query string
8 = hash
1
926
posted 15 years ago by remotezygote
This regular expression will match almost all valid email addresses. Omits email addresses containing double-quotes and square brackets, which while valid according to [RFC 2822][rfc2822], are almost never used.
[rfc2822]: http://tools.ietf.org/ht...
2
1177
posted 15 years ago by chrisdpratt
This finds individual CSS attributes, i.e. "foo : bar;" or "bar : 2px solid foo;"
4
1612
posted 15 years ago by mocha0range
This finds CSS style names, i.e. "#foo" or "#foo, .bar"
Note: You'll need to chomp the trailing "\s{" off the end of the matched string. I matched it just to make sure that it didn't get anything else.
5
978
posted 15 years ago by mocha0range
This finds the entire style definition - from #foo to the last brace.
i.e. ".foo, #bar { foo: bar; foo: bar; bar: foo; }"
4
900
posted 15 years ago by mocha0range
Use this to quickly clean-up a file which has opening braces on a new line, a particular annoyance of mine.
1
898
posted 15 years ago by Zenithus
This snippet is useful if you want to extract the relevant parts out of an Date header field of an email message. It was created according to the [RFC 5322 rules](http://tools.ietf.org/html/rfc5322#page-15 "RFC 5322, Page 15"). It supports named capt...
1
1007
posted 15 years ago by dreadwarrior
Credits to Julie. Here is a regex if you want this criteria:
* Passwords will contain at least (1) upper case letter
* Passwords will contain at least (1) lower case letter
* Passwords will contain at least (1) number or special character...
2
908
posted 15 years ago by axelitus
http://www.trentmueller.com/blog/search-and-replace-wildcard-characters-in-dreamweaver.html
-and-
http://www.webmasterworld.com/forum46/1288.htm
0
797
posted 15 years ago by rwczippy
<p(.+)">
wählt alle p tags
<option>
dies entfernt alle
<option>
<option>
<option>
0
731
posted 15 years ago by nico65
Use this to extract an HTML5 origin from a URI. $1 is the origin.
The square brackets are there to support IPv6 addresses.
Example:
var html5OriginRegex = /^([\w-]+:\/*\[?[\w\.:-]+\]?(?::\d+)?).*/;
"http://www.google.com:42/foo/bar/...
0
656
posted 16 years ago by Sephr
I know it's a very quick & simple Regex, but someone from work need it so I thought I should also put it here
1
885
posted 16 years ago by cristianciofu
This email snippet was borrowed from (FlashJunior), the original snippit is: http://snipplr.com/view/7743/email-check/
0
710
posted 16 years ago by binarynomad