Talk:1171: Perl Problems

Explain xkcd: It's 'cause you're dumb.
(Difference between revisions)
Jump to: navigation, search
(lgmiKrdcWoYJQMiWvgQ)
m (Reverted edits by 5.63.144.78 (talk) to last revision by Alpha)
Line 1: Line 1:
is dhan ko jutaane mein main bhi thodi si chohti si madad karna chahunga .aur mujhe pata hai ki aur log bhi sehyog dene ko tayyar honge .kripya batyein ki hum sab aapki madad kaise kar sakte hain..itne pathak hai kavita kosh k..sab mil kar vyay ko aaram se utha sakte hain tareeka batayein.. pratiksha rahegi
+
The punchline is in reference to this oft-quoted joke by jwz:
 +
 
 +
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - Jamie Zawinski
 +
 
 +
There's actually a double joke here: The song "99 Problems" is by Jay-Z, and the regex joke is by jwz.
 +
--[[Special:Contributions/173.8.183.86|173.8.183.86]] 08:33, 8 February 2013 (UTC)
 +
:[Jj][A-Za-z]*[\b\-]*[Zz][A-Za-z]* [[User:Elsbree|Elsbree]] ([[User talk:Elsbree|talk]]) 17:31, 8 February 2013 (UTC)
 +
 
 +
I don't understand why so many people have problems with regular expressions. They are really easy ... compared to gramatics or turing machines. :-)
 +
(Of course, it is good idea to verify that the problem you are trying to solve with regular expressions IS regular. While perl is sometimes capable of doing stuff outside real regular expressions, it's rarely worth it.) -- [[User:Hkmaly|Hkmaly]] ([[User talk:Hkmaly|talk]]) 10:23, 8 February 2013 (UTC)
 +
 
 +
Wait, how do we rule out that the Regular Expressions might've helped Cueball, and that now, in fact, he has only 4 problems? [[Special:Contributions/220.224.246.97|220.224.246.97]] 15:52, 8 February 2013 (UTC)
 +
 
 +
Great explanation today, folks. --[[User:DanB|DanB]] ([[User talk:DanB|talk]]) 20:10, 8 February 2013 (UTC)
 +
 
 +
The stuff about preg_match is NOT '''perl''' at all.  It is '''php'''.
 +
'''perl''' has regular expression matching as part of the language, not as a function.
 +
In perl, you would normally only get the firrst match, unless you used the 'g' flag.
 +
The comparable initial match might be:  <code>@matches = $str =~ m/([A-Za-z])/g;</code>
 +
But if you only wanted the first match, it would be more common to write something like <code>$firstMatch = $str =~ m/([A-Za-z])/ && $1;</code>
 +
I think that if you do want all the matches in perl, you are better off doing it in an explicit loop, so as to avoid creating an unneeded array.
 +
(Perl now considers using the "complete match" token to be a less than ideal thing to use, which is why I added the parens and used <code>$1</code> instead of <code>$&</code>.)  --[[User:Divad27182|Divad27182]] ([[User talk:Divad27182|talk]]) 06:33, 9 February 2013 (UTC)
 +
 
 +
If you're havin' Perl problems I feel bad for you, son - I got 99 problems, but regex ain't one. {{unsigned|‎150.252.114.126}}
 +
 
 +
[User talk:Divad27182] is right. I took the liberty to remove the Perl reference in that line. [[Special:Contributions/87.165.125.229|87.165.125.229]] 10:05, 11 February 2013 (UTC)
 +
 
 +
[[Special:Contributions/192.193.116.137|192.193.116.137]] 15:47, 11 February 2013 (UTC)Is there not an "off by one" joke in here also?

Revision as of 07:44, 22 February 2013

The punchline is in reference to this oft-quoted joke by jwz:

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - Jamie Zawinski

There's actually a double joke here: The song "99 Problems" is by Jay-Z, and the regex joke is by jwz. --173.8.183.86 08:33, 8 February 2013 (UTC)

[Jj][A-Za-z]*[\b\-]*[Zz][A-Za-z]* Elsbree (talk) 17:31, 8 February 2013 (UTC)

I don't understand why so many people have problems with regular expressions. They are really easy ... compared to gramatics or turing machines. :-) (Of course, it is good idea to verify that the problem you are trying to solve with regular expressions IS regular. While perl is sometimes capable of doing stuff outside real regular expressions, it's rarely worth it.) -- Hkmaly (talk) 10:23, 8 February 2013 (UTC)

Wait, how do we rule out that the Regular Expressions might've helped Cueball, and that now, in fact, he has only 4 problems? 220.224.246.97 15:52, 8 February 2013 (UTC)

Great explanation today, folks. --DanB (talk) 20:10, 8 February 2013 (UTC)

The stuff about preg_match is NOT perl at all. It is php. perl has regular expression matching as part of the language, not as a function. In perl, you would normally only get the firrst match, unless you used the 'g' flag. The comparable initial match might be: @matches = $str =~ m/([A-Za-z])/g; But if you only wanted the first match, it would be more common to write something like $firstMatch = $str =~ m/([A-Za-z])/ && $1; I think that if you do want all the matches in perl, you are better off doing it in an explicit loop, so as to avoid creating an unneeded array. (Perl now considers using the "complete match" token to be a less than ideal thing to use, which is why I added the parens and used $1 instead of $&.) --Divad27182 (talk) 06:33, 9 February 2013 (UTC)

If you're havin' Perl problems I feel bad for you, son - I got 99 problems, but regex ain't one. ‎150.252.114.126 (talk) (please sign your comments with ~~~~)

[User talk:Divad27182] is right. I took the liberty to remove the Perl reference in that line. 87.165.125.229 10:05, 11 February 2013 (UTC)

192.193.116.137 15:47, 11 February 2013 (UTC)Is there not an "off by one" joke in here also?

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox

It seems you are using noscript, which is stopping our project wonderful ads from working. Explain xkcd uses ads to pay for bandwidth, and we manually approve all our advertisers, and our ads are restricted to unobtrusive images and slow animated GIFs. If you found this site helpful, please consider whitelisting us.

Want to advertise with us, or donate to us with Paypal or Bitcoin?