Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegEx String between 2 different strings MultiLine

Status
Not open for further replies.

nzcam

Programmer
Mar 5, 2003
36
NZ
Hi, I am trying to come up with a regex for retreiving the text/number between 2 different strings in a multiline text field.
Any ideas

EG

I would like to strip the number out that lies between DSL: and customers in the following

Impact at 04/01/2012 21:28
DSL: 92 customers on TEST111
test Office (IDA): 3
*****************************
. Updated: Today
 
in javascript I would do:-
var s =
"Impact at 04/01/2012 21:28"+
"DSL: 92 customers on TEST111"+
"test Office (IDA): 3";
alert(s.match(/dsl:.*(\d\d)/i)[1]);

Hope it helps.
 
The following pattern works nicely in my RegEx tester:
Code:
(DSL:[\s])([0-9]+)([\s])
You can then extract the number by reading the second group of the resulting match.

Hope this helps.

Cheers,
MakeItSo

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top