Ferrous Moon http://www.ferrousmoon.com:80/forums/ |
|
Check my regex please :) http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=1663 |
Page 1 of 1 |
Author: | eddieringle [Sun Jan 18, 2009 6:26 pm ] |
Post subject: | Check my regex please :) |
I just read a brief tutorial on regex because I need to match hyperlinks for a program I am writing. I basically need to match any hyperlink, with any protocol. I've used http://gskinner.com/RegExr/ to play around, and this is what I've come up with: Code: [A-Za-z0-9]+://[A-Za-z0-9./?=+%;&-]*
I've made sure that it matches special characters inside links as well. But I just want to post it here to see if anyone has something to add, like a quicker way to match any special character.EDIT: Oh yeah, and I suppose to turn a plain text url into a hyperlink I'd use this: Code: <a href="$&">$&</a>
|
Page 1 of 1 | All times are UTC-05:00 |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |