User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 3 Sep 2006, 18:33   #1
meglamaniac
Born Sinful
 
meglamaniac's Avatar
 
Join Date: Nov 2000
Location: Loughborough, UK
Posts: 4,059
meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
regex help

Ok, my mind's gone blank here and I'm just going round in circles.

Lets say you have a localised path to a file on a webserver, eg:

/dir1/dir2/dir3/file.ext

There is no telling what the file might be called, so you can't check the extension.
All I want is the bit after the last slash - the filename.
This seems ludicrously simple. I honestly can't believe I'm stuck. But I am. Someone please enlighten me.
__________________
Worth dying for. Worth killing for. Worth going to hell for. Amen.
meglamaniac is offline   Reply With Quote
Unread 3 Sep 2006, 18:49   #2
meglamaniac
Born Sinful
 
meglamaniac's Avatar
 
Join Date: Nov 2000
Location: Loughborough, UK
Posts: 4,059
meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: regex help

Got it.
For future reference:

[^\/]*$

A character that is not a slash ([^\/]) followed by anything (*) followed by the end of the string ($)
__________________
Worth dying for. Worth killing for. Worth going to hell for. Amen.
meglamaniac is offline   Reply With Quote
Unread 19 Sep 2006, 13:10   #3
mazzelaar
Vitriolic
 
mazzelaar's Avatar
 
Join Date: Nov 2001
Location: #public
Posts: 1,506
mazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriendmazzelaar needs a job and a girlfriend
Re: regex help

Also for future reference:

http://weitz.de/regex-coach/

A marvellous bit of software.
__________________
Chief [1up] Chimp.

<@JBG> by the way is mazzelaar a community account that everyone in 1up logs into when they're feeling angry?

Quote:
Originally Posted by JohnnyBGood
mazzelaar has always reminded me of a hungry hungry hippo. Except instead of eating marbles he just bites the heads off new AD posters
mazzelaar is offline   Reply With Quote
Unread 19 Sep 2006, 14:03   #4
Heartless
CRASHING BEATS 'N FANTASY
 
Heartless's Avatar
 
Join Date: Mar 2001
Location: Cold Country.
Posts: 1,912
Heartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like himHeartless is an inspiration to us all and we should try to be more like him
Re: regex help

Also keep in mind Jamie Zawinski:

"Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems."
__________________
Ią! Ią! Munin F'tagn! - [*scendancy]
Heartless is offline   Reply With Quote
Unread 19 Sep 2006, 14:48   #5
meglamaniac
Born Sinful
 
meglamaniac's Avatar
 
Join Date: Nov 2000
Location: Loughborough, UK
Posts: 4,059
meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: regex help

Heh. The trouble is, they're powerful and quite often the only sensible way to go about doing any pattern matching above simple tokenising. They're also a lot easier to build than they are to read.
__________________
Worth dying for. Worth killing for. Worth going to hell for. Amen.
meglamaniac is offline   Reply With Quote
Unread 20 Sep 2006, 13:49   #6
djbass
mmm.. pills
 
djbass's Avatar
 
Join Date: Apr 2000
Location: Australia
Posts: 2,152
djbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond repute
Re: regex help

I've only jumped on the regex bandwagon recently while writing a lua addon for WoW (since it had no tokenising function). Very handy, but I think for simplicities sake I prefer C's strtok() and do my own parsing.
__________________
CSS : the result of letting artists design something only an engineer should touch.
djbass is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 06:01.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018