Geek And Poke
Cartoons
Home
March 02, 2010
Geek Bar
Mar 2, 2010 12:07:39 AM
NEXT POST
Simply Explained - Edge Cases
PREVIOUS POST
Geeks In The Wild
Oliver Widder
I'm a IT-guy in Hamburg, Germany
1
Following
319
Followers
Search
My Other Accounts
Twitter
|
geekandpoke
Recent Comments
Wolf:
DELETE top, pants, bra FROM women WHERE sexylev...
|
more »
On
commands.sql
Cyrus McDugan:
Does that really work? I can tell you, that it ...
|
more »
On
commands.sql
Michael:
Dad? What is a floppy drive? :-D Im getting soo...
|
more »
On
The Social Generation
If my regex-fu is still strong, that would be:
Coffee 1.50
Beer 2.40
Posted by: Daniel | March 02, 2010 at 12:13 AM
That's what I got too, although the biggest joke was that I took the time to work it out =D
Posted by: Andy Palmer | March 02, 2010 at 01:02 AM
Looks like I'm a half-geek: got the 1.50 and 2.40, but failed at recognizing $1 as something else than "1 USD".
Real people use \1 and \2 anyway!!1
Posted by: pascal | March 02, 2010 at 01:45 AM
Biggest joke IMHO: There is no such thing as a "Geek Bar"
Posted by: Ocaso Protal | March 02, 2010 at 07:55 AM
This is Perl regular expression and using $1 and $2 seems perfectly valid as per "perldoc perlre", section "Capture buffers" examples.
Also try this:
perl -e '"1239.28912121.5011.2129829.02.4021" =~ m/2(\d\.\d+?)1.*0(\d\.\d+)2/ ; print "Coffee $1\nBeer $2\n"'
It works perfectly with $1 and $2, but not with \1 and \2.
Posted by: Account Deleted | March 02, 2010 at 09:31 PM
\1 and \2 are to be used in substitutions. Outside the regular expression, they're meaningless, so you must use $1 and $2
Posted by: Marcelo Roccasalva | March 04, 2010 at 02:42 AM
The joke, to me, is that people who grok regex get an intelligence tax of 50c on coffee, 40c on beer :)
Better to pretend you don't know regexes, and just give the USD amount shown.
If the barman grumbles, say his sign never stated a currency, so you're paying him the equivalent in $CAD.
Posted by: Dewi Morgan | August 25, 2010 at 01:39 AM