473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

match method of String...

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
3 1152
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ron Adam | last post by:
Is it possible to match a string to regular expression pattern instead of the other way around? For example, instead of finding a match within a string, I want to find out, (pass or fail), if...
0
by: Follower | last post by:
Hi, I am working on a function to return extracts from a text document with a specific phrase highlighted (i.e. display the context of the matched phrase). The requirements are: * Match...
1
by: Venkat | last post by:
Hi, I am using match function of string to find if a character is there in a string. The function Match is working fine with all the other characters except when the searching character is "+"....
3
by: Jeff McPhail | last post by:
I am using Regex.Match in a large application and the memory is growing out of control. I have tried several ways to try and release the memory and none of them work. Here are some similar examples...
7
by: Clint Herron | last post by:
Howdy! I posted this question on CSharpCorner.com, but then realized I should probably post it on a more active newsgroup. This will be my only cross-post. I'm creating a game engine, and...
4
by: Chris | last post by:
Hi Everyone, I am using a regex to check for a string. When all the file contains is my test string the regex returns a match, but when I embed the test string in the middle of a text file a...
2
by: Rob | last post by:
I've just about beat my brains all the way out on this one. Is anyone up to the amazingly ridiculous challenge of figuring this one out? Here's the code, followed by my question: <script...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
20
by: arnimavidyarthy | last post by:
Hi, Hi, I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried the folllowing in kodos but they are still not perfect:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.