How to do this with regular expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I do something like search for a pattern but only get a part of the
pattern instead of the whole string as a match?

for example lets say I'm searching the following string:

Variable1=ABCD&Variable2=1234&Variable3=ASDF

and my regex pattern is "Variable2=[0-9]*"

can I do something to do that pattern so instead of my matches coming back
like
"Variable2=1234"
"Variable2=5678"
etc...

that I just get the actual number?
"1234"
"5678"
 
MrNobody said:
Can I do something like search for a pattern but only get a part of the
pattern instead of the whole string as a match?

Variable2=([0-9]*)

-- Alan
 
Ohh, and you can have multiple sets of parenthesis which are termed groups?

Thank You I love you!

Alan Pretre said:
MrNobody said:
Can I do something like search for a pattern but only get a part of the
pattern instead of the whole string as a match?

Variable2=([0-9]*)

-- Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top