Need Help With Regular Expression?
Javascript, Regular Expressions March 20th, 2009Hi all,
I need help with Regex (Regular Expression).
I need help with Regex (Regular Expression).
For example there's a webpage on a website, and I want to get the first link on that webpage, after certain words.
e.g:
"Website from http://www.website.com/blabla.php?var=blabla&se=3290 is awesome"
question: how to get the link only
http://www.website.com/blabla.php?var=blabla&se=3290
Here's a solution using javascript:
var strW = "website from http://www.website. com/blabla.php?var=blabla&se=3290 is awesome"; var regW = /(website|Website).* (http[^\s]*).* (awesome|great)/; if (regW.test(strW)) alert (RegExp.$2);
Add/delete the key words preceding and following the URL. The URL is referenced using RegExp.$2