Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 02-11-2013, 04:51 PM   #1
madtwin
Confirmed User
 
Industry Role:
Join Date: Aug 2009
Posts: 274
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/?

madtwin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-11-2013, 10:31 PM   #2
Barry-xlovecam
It's 42
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 18,083
Use a split

Simpler to use a split; "\?"
Code:
#!/usr/bin/perl

use strict;
use warnings;


my $URLstring = "http://gallys.40somethingmag.com/images/BettyBlaze_28866/?nats=XXXXXXXXXXXXX";

our @url = split  /\?/, $URLstring;

print $url[0] ."\n";

exit;
#output
#12:24 AM barry@server:~/Desktop$ ./split.cgi
#http://gallys.40somethingmag.com/images/BettyBlaze_28866/
or regex then just substr 0, -1 ( in perl chop $url[0];)

Last edited by Barry-xlovecam; 02-11-2013 at 10:35 PM..
Barry-xlovecam is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 02-12-2013, 01:35 AM   #3
madtwin
Confirmed User
 
Industry Role:
Join Date: Aug 2009
Posts: 274
Thank you
madtwin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 03-08-2013, 07:31 PM   #4
hotbodybattles
Registered User
 
Industry Role:
Join Date: May 2011
Location: New England
Posts: 28
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
hotbodybattles is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.