$filename =~ s/^.*[\/\\]([^\/\\]+)$/$1/;

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: schizoid
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

Heh.

When you type in "poop" there, it comes out...well...it says poop! But it's all big and stuff.

I'm sure it'd mess up the spacing if I cut and pasted, but you can use your imagination.

You at Davis?
 

schizoid

Banned
May 27, 2000
2,207
1
0
Originally posted by: notfred
Originally posted by: schizoid
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

Heh.

When you type in "poop" there, it comes out...well...it says poop! But it's all big and stuff.

I'm sure it'd mess up the spacing if I cut and pasted, but you can use your imagination.

You at Davis?

I was.

I might be again, if God decides he hates me and wants to see me suffer through another 4 years in the PhD program (and threatens to smite down Duke, USC, UCSB, UCSD and NYU if they accept me).

I wrote Droppin' Sez, if you ever read that.

 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: notfred
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

stupid website.

"sorry, no funky punctuation, too many people try and hack me with backticks and pipes and whatnot."

hey that's my stupid website ;)

and that page is ancient, be easy on a newbie.
 

schizoid

Banned
May 27, 2000
2,207
1
0
Originally posted by: notfred
Nope never read that :)

I hate you.

Sigh...my column ruled.

Prolly cuz I rule.

But yeah, you'll be able to read it online soon enough.

WEEEEEEEEEEEEeeeeeeeeeeeee

you go to Davis?

 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: BingBongWongFooey
Originally posted by: notfred
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

stupid website.

"sorry, no funky punctuation, too many people try and hack me with backticks and pipes and whatnot."

hey that's my stupid website ;)

and that page is ancient, be easy on a newbie.

Nah, I was trying to hack it with backticks and pipes and stuff, so the message was deserved :eek:
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: notfred
Originally posted by: BingBongWongFooey
Originally posted by: notfred
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

stupid website.

"sorry, no funky punctuation, too many people try and hack me with backticks and pipes and whatnot."

hey that's my stupid website ;)

and that page is ancient, be easy on a newbie.

Nah, I was trying to hack it with backticks and pipes and stuff, so the message was deserved :eek:

at first i tried some regex magic to only allow certain punctuation marks, but i said screw it, "better safe than sorry", and just allowed a-zA-Z0-9 :)
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: BingBongWongFooey

at first i tried some regex magic to only allow certain punctuation marks, but i said screw it, "better safe than sorry", and just allowed a-zA-Z0-9 :)

cant do \w\d with the inferior product known as PHP or what? :p
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: notfred
Originally posted by: BingBongWongFooey

at first i tried some regex magic to only allow certain punctuation marks, but i said screw it, "better safe than sorry", and just allowed a-zA-Z0-9 :)

cant do \w\d with the inferior product known as PHP or what? :p

think so. i've never gotten real deep into regex, so i tend to forget things like that.

and php supports full perl regex's :D

preg_match() and preg_replace()
 

schizoid

Banned
May 27, 2000
2,207
1
0
Originally posted by: BingBongWongFooey
Originally posted by: notfred
Originally posted by: BingBongWongFooey

at first i tried some regex magic to only allow certain punctuation marks, but i said screw it, "better safe than sorry", and just allowed a-zA-Z0-9 :)

cant do \w\d with the inferior product known as PHP or what? :p

think so. i've never gotten real deep into regex, so i tend to forget things like that.

and php supports full perl regex's :D

preg_match() and preg_replace()


preg_replace? Is that like a weird combination of abortion and aritficial ensemination?

 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: schizoid
Originally posted by: BingBongWongFooey
Originally posted by: notfred
Originally posted by: BingBongWongFooey

at first i tried some regex magic to only allow certain punctuation marks, but i said screw it, "better safe than sorry", and just allowed a-zA-Z0-9 :)

cant do \w\d with the inferior product known as PHP or what? :p

think so. i've never gotten real deep into regex, so i tend to forget things like that.

and php supports full perl regex's :D

preg_match() and preg_replace()


preg_replace? Is that like a weird combination of abortion and aritficial ensemination?

not since 4.1
 

DaFinn

Diamond Member
Jan 24, 2002
4,725
0
0
Originally posted by: notfred
Originally posted by: Ameesh
rolleye.gif


god i hate perl coders

and we just love MS fanboys
rolleye.gif


and I hate all coders and coding...

My boss just came up to me an said he want's me to add a feature to an age old Cobol program we still use...
(custom made for us, and costed an arm and leg at the time...)
"I just want a button that let's me send a listing or report I take by email... shouldn't be too hard!"
I was like:
"Yeah, button shouldn't be too hard... but do you want the button actually to do something???"

Shit, here I am learning Cobol of all languages... I love this job...
:frown:
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: DaFinn
Originally posted by: notfred
Originally posted by: Ameesh
rolleye.gif


god i hate perl coders

and we just love MS fanboys
rolleye.gif


and I hate all coders and coding...

My boss just came up to me an said he want's me to add a feature to an age old Cobol program we still use...
(custom made for us, and costed an arm and leg at the time...)
"I just want a button that let's me send a listing or report I take by email... shouldn't be too hard!"
I was like:
"Yeah, button shouldn't be too hard... but do you want the button actually to do something???"

Shit, here I am learning Cobol of all languages... I love this job...
:frown:

i'm sure you will survive. i flip burgers for a dollar over minimum wage.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: BingBongWongFooey
Originally posted by: DaFinn
Originally posted by: notfred
Originally posted by: Ameesh
rolleye.gif


god i hate perl coders

and we just love MS fanboys
rolleye.gif


and I hate all coders and coding...

My boss just came up to me an said he want's me to add a feature to an age old Cobol program we still use...
(custom made for us, and costed an arm and leg at the time...)
"I just want a button that let's me send a listing or report I take by email... shouldn't be too hard!"
I was like:
"Yeah, button shouldn't be too hard... but do you want the button actually to do something???"

Shit, here I am learning Cobol of all languages... I love this job...
:frown:

i'm sure you will survive. i flip burgers for a dollar over minimum wage.

haha, your job sucks.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: notfred
Originally posted by: BingBongWongFooey
Originally posted by: DaFinn
Originally posted by: notfred
Originally posted by: Ameesh
rolleye.gif


god i hate perl coders

and we just love MS fanboys
rolleye.gif


and I hate all coders and coding...

My boss just came up to me an said he want's me to add a feature to an age old Cobol program we still use...
(custom made for us, and costed an arm and leg at the time...)
"I just want a button that let's me send a listing or report I take by email... shouldn't be too hard!"
I was like:
"Yeah, button shouldn't be too hard... but do you want the button actually to do something???"

Shit, here I am learning Cobol of all languages... I love this job...
:frown:

i'm sure you will survive. i flip burgers for a dollar over minimum wage.

haha, your job sucks.

thanks.
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

|_ _|_ __ ___ _ __ ___ __ _ | ___|_ _____| | _| |_ __ _ _ __ __| |
| || '_ ` _ \| '_ ` _ \ / _` | | |_ \ \ / / __| |/ / __/ _` | '__/ _` |
| || | | | | | | | | | | (_| | | _| \ V / (__| <| || (_| | | | (_| |
|___|_| |_| |_|_| |_| |_|\__,_| |_| \_/ \___|_|\_\\__\__,_|_| \__,_|


Damn it didn't work :(
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: ffmcobalt
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

|_ _|_ __ ___ _ __ ___ __ _ | ___|_ _____| | _| |_ __ _ _ __ __| |
| || '_ ` _ \| '_ ` _ \ / _` | | |_ \ \ / / __| |/ / __/ _` | '__/ _` |
| || | | | | | | | | | | (_| | | _| \ V / (__| <| || (_| | | | (_| |
|___|_| |_| |_|_| |_| |_|\__,_| |_| \_/ \___|_|\_\\__\__,_|_| \__,_|


Damn it didn't work :(

immafucktard?
 

DaFinn

Diamond Member
Jan 24, 2002
4,725
0
0
Originally posted by: ffmcobalt
Originally posted by: BingBongWongFooey
I still type "echo poop" at unix prompts because I think it's funny.

:D<------------

|_ _|_ __ ___ _ __ ___ __ _ | ___|_ _____| | _| |_ __ _ _ __ __| |
| || '_ ` _ \| '_ ` _ \ / _` | | |_ \ \ / / __| |/ / __/ _` | '__/ _` |
| || | | | | | | | | | | (_| | | _| \ V / (__| <| || (_| | | | (_| |
|___|_| |_| |_|_| |_| |_|\__,_| |_| \_/ \___|_|\_\\__\__,_|_| \__,_|


Damn it didn't work :(

Doh! :D
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0
Originally posted by: notfred
regular expressions are one of the best things ever.

CFG >> Regular Expressions

Python runtime is faster then perl as python standard libraries are nativly compiled C apps rather then esoteric interperted nonsense.

and I'm gonna have to go with Schizoid on this: ML is the most ass language out there, i hate it, its the devil. when people say somebody set us up the bomb, that "somebody" is ML
 

ProviaFan

Lifer
Mar 17, 2001
14,993
1
0
Originally posted by: Ameesh
Originally posted by: notfred
regular expressions are one of the best things ever.
CFG >> Regular Expressions
Huh? I googled for CFG and didn't find anything that looked relevant, except for some C header file processor thing on the 3rd or 4th page. Oh well, what Ameesh says is not going to deter me from continuing in my journey to learn regular expressions, since he only says they are not the best simply because he has an allergic reaction to all things open source.
rolleye.gif
 

numark

Golden Member
Sep 17, 2002
1,005
0
0
Originally posted by: BingBongWongFooey
$filename =~ s/^.*[\/\\]([^\/\\]+)$/$1/;

filename = re.sub(r'^(.*)[/\]([^/\]+)$', r'\1', filename)

python > perl :D

I don't trust any language that determines for me the way I have to format my code. I'll tab where I want to tab, d@mn it! :D
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
For someone that loves Perl and regular expressions so much, one would think you'd craft an efficient expression :)

Why bother w/ the superfluous '.' and the greedy quantifier? ([^\/\\]+)$ would work just as nicely.