By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,483 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,483 IT Pros & Developers. It's quick & easy.

match method of String...

P: n/a
Hi folks,
Consider the following string:

var s = 'http://whatever/default.aspx?subid=202&brand=x'

I need to use the match method of String object to find an exact
following pattern:

subid=202

How can I do so?

TIA,
Mehdi

Sep 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
mehdi_mousavi <me***********@gmail.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
Hi folks,
Consider the following string:

var s = 'http://whatever/default.aspx?subid=202&brand=x'

I need to use the match method of String object to find an exact
following pattern:

subid=202

How can I do so?


Create a suitable regular expression and pass it to s.match();

Assign the returned value to a variable; if it isn't null, examine its documented properties.

http://developer.mozilla.org/en/docs...s:String:match

--
S.C.

Sep 23 '05 #2

P: n/a
Hmmm... I need the "suitable expression", actually! Would you please
provide me with that?

Considering the following assignement:
var s = 'http://whatever/default.aspx?subid=202&brand=x'

s.match('subid=' + 2)

does not return null!!!! what's that suitable expression???

Thanks

Sep 23 '05 #3

P: n/a
mehdi_mousavi <me***********@gmail.com> wrote in message news:11*********************@g44g2000cwa.googlegro ups.com...
Hmmm... I need the "suitable expression", actually! Would you please
provide me with that?

Considering the following assignement:
var s = 'http://whatever/default.aspx?subid=202&brand=x'

s.match('subid=' + 2)

does not return null!!!! what's that suitable expression???

Thanks


After assimilating the information the address below, you should have no difficulty
creating a regular expression that meets your requirements.

http://developer.mozilla.org/en/docs...Objects:RegExp

--
S.C.
Sep 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.