List Info

Thread: Help Parsing a URL string




Help Parsing a URL string
user name
2006-12-07 16:39:50
Hello,
I am pretty new to RegEx so bear with me...

for the URL string below, I am trying to get the
"TEXT2" out of it
using JavaScript:

/BLAH/c/TEXT1.TEXT2.TEXT3?VARIABLE=&DESCRIPTION

I know that it will always be after the "/c/" and
after the "."
following that. I have tried using this:

w = window;
var comp = w.strvalue.search(//c/([A-Z0-9_.]+)/);
alert(RegExp.$1);

This returns "TEXT1.TEXT2.TEXT3"

Any thoughts or do I have to take the value my regular
expression gives
me, and then parse that again by "." to get the
second one?

Thanks!
Derek


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Help Parsing a URL string
user name
2006-12-07 17:09:31
Hi Derek,

You can try this for your regular expression:

//c/[^.]+.([^.]+)/

Rick Quatro

On 12/7/06, Derek < derek.degrootwellsfargo.com"> derek.degrootwellsfargo.com> wrote:

Hello,
I am pretty new to RegEx so bear with me...

for the URL string below, I am trying to get the "TEXT2" out of it
using JavaScript:

/BLAH/c/TEXT1.TEXT2.TEXT3?VARIABLE=&DESCRIPTION

I know that it will always be after the "/c/&quot; and after the ".&quot;
following that. I have tried using this:

w = window;
var comp = w.strvalue.search(//c/([A-Z0-9_.]+)/);
alert(RegExp.$1);

This returns "TEXT1.TEXT2.TEXT3"

Any thoughts or do I have to take the value my regular expression gives
me, and then parse that again by ".&quot; to get the second one?

Thanks!
Derek





--
Rick Quatro
585-659-8267
http://www.frameexpert.com
--~--~---------~--~----~------------~-------~--~----~
&nbsp;You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Help Parsing a URL string
user name
2006-12-07 17:18:32
That seemed to work great! 

Thank you Rick!


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )