View Full Version : RegExp compare strings problem

11-05-2004, 12:08 PM
I would like to compare two strings, and if the first one, say x, is included and is at the begining of the second string, say y, than doSomething()

var x= 'abc'
var y='abcdef'

if ( y==x+'someotherstring'){doSomething()}

any ideeas?

11-05-2004, 12:24 PM
try this: if (/^(abc)/i.test(y)) alert("woohoo: string found!";

11-05-2004, 12:41 PM

I know the classical


But I would like to use RegExp more often

11-05-2004, 12:44 PM
i know the classical ... I would like to use RegExp more often

RegEx is cooler, if sometimes a lot more complicated. one thing for sure, tho, is it will never be deprecated.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum