![]() |
Regex gurus help the noob
I have url:
http://gallys.40somethingmag.com/ima...=XXXXXXXXXXXXX I need regex to get url without NATS code: http://gallys.40somethingmag.com/ima...tyBlaze_28866/ I have this regex: .*\?.*? but I end up with url like this: http://gallys.40somethingmag.com/ima...yBlaze_28866/? :helpme:helpme:helpme |
Use a split
Simpler to use a split; "\?" Code:
#!/usr/bin/perl or regex then just substr 0, -1 ( in perl chop $url[0];) |
Thank you :thumbsup
|
Regexbuddy is my best friend when writing perl and doing regex.. i used it more than anything when i was an automation engineer back at an old job.. now i'm writing perl code again at work and using it again... it's 40 bucks to buy though.. but you can probably torrent it.. but i didn't say that.
but do a google search for Regexbuddy and the second hit down will be a thread on stackoverflow called "Is there anything like RegexBuddy in the open - Stack Overflow" that has some nice tools listed... if you still need em... regex'es can be a bitch.. or easy... sometimes you have to think outside the box and break down the string a bit more prior to regex'ing it.. good luck |
All times are GMT -7. The time now is 12:29 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc