Created
April 25, 2014 04:24
-
-
Save 1Marc/11277624 to your computer and use it in GitHub Desktop.
Regex keyword filter spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keywords here are "SVG" and "CSS3" | |
The regex should find only words found in the text or in individual keywords in a URL seperated by dashes. It should NOT match any keywords located in shortned URL hashes. | |
Should match: | |
"I love this thing about SVG. http://foo.com/article" | |
"This is awesome http://super-awesome-svg.com" | |
"I <3 this css3 button thing http://codepen.com/abcdefg" | |
Should NOT match: | |
"This is a thing we are testing. It should not match this http://t.co/ifesVgief" | |
"Boogy buggy booger. It should not match this http://t.co/ewfijCSs3few" |
tednaleid
commented
Apr 25, 2014
Ted -- that looks great!
Looks like @jonfriskics got it working as well --> https://gist.github.com/anonymous/11278042
var reg = new RegExp(/(\bcss3|svg\b)+|https?://(www.)?\w+.\w+\/(-css3|svg-)/ig);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment