-
1. Re: Rex Exp help
Muppet Mark Apr 28, 2012 3:58 AM (in response to Muppet Mark)A lesson learned I thinks… Two indexOf() and an slice( a, b ); was way way faster for all I wanted… Sorry for troubling you's…
-
2. Re: Rex Exp help
Muppet Mark Apr 28, 2012 4:01 AM (in response to Muppet Mark)Can I really give myself points for that? I don't think so… Should be shot for not tring it first…
-
3. Re: Rex Exp help
Paul Riggott Apr 28, 2012 7:14 AM (in response to Muppet Mark)Would something like this work for you Mark?
var str="!PS-Adobe-3.0This is the text I want%EndComments"; alert(str.match(/Adobe-3.0[^%]*/).toString().substr(9));
Or even this...
var str="!PS-Adobe-3.0This is the text I want%EndComments!\r\r\r"; str +="<fsgfxjsdcjsdcj>PS-Adobe-3.0This is the second lot of text I want%EndComments"; var parts = str.match(/Adobe-3.0(.*?)%EndComments/g); for(var a=0;a<parts.length;a++){ alert(parts[a].toString().match(/Adobe-3.0(.*?)%EndComments/)[1]); } -
4. Re: Rex Exp help
Muppet Mark Apr 28, 2012 8:35 AM (in response to Paul Riggott)Paul, I will take a look at those when I get the time… ( see if I can work the methods out ) My stupid muppet issue was treating this whole thing as variable text but its NOT start and end are constants and I can get all between… This is much faster… 30 seconds with reg exp milliseconds with indexOf I can then use rex exp on a vastly smaller chunk of data… I've meanwhlie shot myself in the head… 6 times to no effect… who said happiness is a warm gun…
-
5. Re: Rex Exp help
Michael L Hale Apr 28, 2012 8:45 AM (in response to Paul Riggott)Paul posted the RegExp I was going to suggest.
As far as match indexes go if you use exec() you can get the index of the match
var str="!PS-Adobe-3.0This is the text I want%EndComments!/r/r/r"; str +="<fsgfxjsdcjsdcj>PS-Adobe-3.0This is the second lot of text I want%EndComments"; var RE = /Adobe-3.0(.*?)%EndComments/g; var match = null; while( match = RE.exec(str) ){ alert(match.index); } -
6. Re: Rex Exp help
Muppet Mark Apr 28, 2012 11:39 AM (in response to Michael L Hale)Paul, Isn't live boring when your always right? Mike that I don't recall seeing one before thanks, I would never have worked that out from the guides… Hum a long n arduous road ahead…

