Regular Expressions are beautiful things.

notfred

Lifer
Feb 12, 2001
38,241
4
0
I came up with this at work, and it was so nice looking, I had to post it:

$last =~ s/^(\w\w\w)\w+,\s(\d+)-([^-]+)-(\d+)\s([\d:]+).*/$1 $3 $2 $5 $4/;
 

tallest1

Diamond Member
Jul 11, 2001
3,474
0
0
I got two books that focus solely on Regular Expressions. Its awesome. I wish Google would adapt it.
 

Ameesh

Lifer
Apr 3, 2001
23,686
1
0


<< I got two books that focus solely on Regular Expressions. Its awesome. I wish Google would adapt it. >>



why? when do you need to find every seven letter .org that starts with a t and ends with a q. reg expressions wouldnt make sense google.

youre dumb
 

ElFenix

Elite Member
Super Moderator
Mar 20, 2000
102,407
8,595
126
is suck is a regular expression around here, and its not beautiful. in fact, is suck is suck.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,781
4,754
75
Regular expressions are half the reason I use ViM all the time! :)

So what does that thing do, anyway? Something with a date?
 

notfred

Lifer
Feb 12, 2001
38,241
4
0


<< Regular expressions are half the reason I use ViM all the time! :)

So what does that thing do, anyway? Something with a date?
>>



yeah, it just formats a date.
 

Mucman

Diamond Member
Oct 10, 1999
7,246
1
0
The best part about RE's is that they are easy to make but are dang hard to figure out what they are (at least they are to me :))