ConradJones Posted June 7, 2013 Posted June 7, 2013 I'm after a regex expression to determine if a item of text contains only a URL and nothing else (Spam rule) I'm thinking this should be possible and am reading about it at the moment, if anyone already knows what it is please post it.! My regex is a little rusty, so I've a little catching up to do.
ConradJones Posted June 7, 2013 Author Posted June 7, 2013 okay so i've answered my own question, Regular Expression Library
sonofsanta Posted June 7, 2013 Posted June 7, 2013 You may like: Regex Tester. Has been a godsend for me.
Arthur Posted June 11, 2013 Posted June 11, 2013 (edited) Here's another good regex since it also matches short URLs such as goo.gl, bit.ly and t.co. (?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) Source: Daring Fireball http://i.imgur.com/55kLKcN.png Edited June 11, 2013 by Arthur
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now