Welcome To Snipplr
Everyone's Recent Snippets Tagged regex
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Text filter to increment numbers by one with regex in BBEdit (Mac only)
0
1485
posted 12 years ago by page_lab
The below code lets you stop access from the remote IPs excluding your local machine IP. This code can be setup where someone wants to provide an internal access and restricting the external access for the web service.
- [Automated Predictive Dial...
0
1314
posted 12 years ago by aruldave
Requirement from work was to refactor an 8000 line if elseif code block to select case syntax. Not a manual task, even for a 1984 olympics button bashing champ.
note, id is the test variable here,
as in
elseif (id ="test") then ...
0
923
posted 12 years ago by pflangan
PHP
Remove / Replace - href / anchor /link - in html /string - preg_replace - php - regex - regular expression
Replaces all links within href part of anchor in a HTML-String.
1
3867
posted 12 years ago by rwunsch
This regex captures non-printing characters (specifically those found when copying text from Photoshop). It's not fully tested, but it worked for me when I needed it. I will add to it as necessary.
0
883
posted 12 years ago by oobleck
Find the date with or without a year and with double or single digit month or day. Easily extendable to other date delimiters and formats.
0
1050
posted 12 years ago by pumpkinthehead
This will get the 11-character YouTube video ID from any valid YouTube URL.
Based on http://snipplr.com/view/57065/get-youtube-video-id/ but made more robust to handle additional URL inputs
0
1511
posted 12 years ago by jmiller
Working on an ecommerce site I found out from our Japanese distrubutors that they don't have a decimal for the currency since yen doesn't deal in change. 1 yen is a fraction of a cent anyway!
This code looks for the Yen since within a <span></span...
0
731
posted 13 years ago by cpres
If you don't deal with namespaces in XML correctly they can break your parsing in AS3. One way of getting around this is to remove the namespace from the XML a using regular expression.
0
1121
posted 13 years ago by adrianparr
A really handy snippet that will replace textual URLs with HTML links.
Also works for email addresses.
0
1532
posted 13 years ago by plesh
Returns the same string, except with links wrapped in <a href=""> tags. Works on www.snipplr.com and on http://snipplr.com
A variation of the script on the attached URL.
0
842
posted 13 years ago by nebojsac
Ridiculously comprehensive date validation regex - matches dd/mm/yyyy or dd/mm/yy.
Also correctly matches number of days in months. ie. it won't match 30th Feb...
0
973
posted 13 years ago by shodan_uk
Returns the video id for any type of youtube url that holds one.
2
1254
posted 13 years ago by KabuqueJoe
Encode a Tweet from a Twitter search query wrapping all hash tags, user names and urls with herf entities with one function call
0
630
posted 13 years ago by ninjaparade
Useful for stripping out backslashes, hyphens and other punctuation
0
1372
posted 13 years ago by gromitski
Replace "-" with anything you want to. Useful for amending URLs.
0
1191
posted 13 years ago by gromitski
Modified regex of URL Matcher found on http://daringfireball.net/2010/07/improved_regex_for_matching_urls
0
697
posted 13 years ago by naren1012
The regular expression must be in non-literal notation; so replace all backslashes with two backslashes (e.g. ^\w+$ -> ^\\w+$).
All searches are case insensitive; you can change this by removing the ‘i’ flag in the plugin.
1
886
posted 13 years ago by aelesbao