#perl - Mon 19 Feb 2007 between 04:21 and 04:43



Dragon22stupid regex problem: I have "[a-z][A-Z][0-9].stuff I want" as a string
how do I build a regex to do what I want
I tried with sed, but sed -e 's/^[a-z][A-Z][0-9]*\.//' doesnt do it
nktsDragon22: what do you want from that string?
Dragon22everything after the .
I'm trying to get the extension of a filename
I /should/ be able to do this with sed
if I can't, perl is good too.
nktsDragon22: print "stuff.ext" =~ /([^.]+)$/
BinGOseval: my @m = "stuff.ext" =~ /([^.]+)$/; \@m
buubotBinGOs: ['ext']
fotoflo_arg im tired of gedit, i need a better texteditor
Dragon22roffle, it chokes sed
BinGOsThat's because it is perl regex.
Dragon22I know
I tried just in case
BinGOsGumbyBRAIN: Have you ever wondered how you get triangles from a cow ?
GumbyBRAINall i ever tell you how.
BinGOsGumbyBRAIN: James Dean was just a careless driver. And Marilyn Monroe was just a slag.
GumbyBRAINAnd that just by the tty driver.
Dragon22oh you've got to be kidding me
this should not work
sed -e 's/[a-z]*[A-Z]*[0-9]*//'
it chomps up to the first non alpha numeric character
BinGOsPerhaps you want to start at the other end as it were.
Dragon22hmm
I should convert this to a perl script
BinGOsDragon22: what do you want your sed substitution to do ?
Dragon22BinGOs: extension of a file name
BinGOsremove the extension ?
Dragon22no, retrieve it
ie, remove everything before the last dot
BinGOsYou are using a substitution
Dragon22yes, so?
Im trying to nuke everything before the first dot
BinGOsYes, convert it to perl. Then we maybe able to help.
Dragon22<nkts> Dragon22: print "stuff.ext" =~ /([^.]+)$/
that does what I want in perl
f00li5hyay stuff
BinGOsYay, f00li5h

Page: 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 

IrcArchive