Website Toolbox Pro

Need Help With Regular Expression?

Javascript, Regular Expressions Comments »
Hi all,
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

Regex Help?

Regular Expressions Comments »
What would be a string to replace:

This is $1.00. Ain't that nice
$1.00 for this stuff.
Buy this now for $1.00

with the format:

$1.00 {rest of the stuff from string}
so the output would be.
$1.00 This is . Ain't that nice
$1.00 for this stuff.
$1.00 Buy this now for

Continue reading Regex Help? »

Regular Expression For Validating A String Which Contains Only Characters?

Javascript, Regular Expressions Comments »
Regular expression for validating a string which contains only characters in Javascript?

Continue reading Regular Expression For Validating A String Which Contains Only Characters? »

Javascript: Variables Within Regex?

Javascript, Regular Expressions Comments »
Is it possible to use a variable within a regular expression declaration? For example:

var findThs="test123";
var mystring = "This is some test123 text";
var result = myString.match(/findthis(?:,| |$)/);

This doesnt return a result since findthis is being interpreted as text rather than a variable. I want its contents to be inserted into the regex expression.

Continue reading Javascript: Variables Within Regex? »