Skip navigation.

miscoded

the web is a hack

Y!RegExp quiz

, , , ,

This snippet is brought to you by Yahoo!Japan blogs. Quiz of the day: what is the RegExp meant to do and why does it fail?

if(img.match(/(.[jJ][pP][eE]?[gG]|.[gG][iI][fF]|.[pP][nN][gG])/)) {
return true;
}
return false;


(Yes, the variable name is a hint.)

no ballads in this OperaLaunching OddPatch 0.1 Beta

Comments

citoyen 18. September 2006, 13:58

Nice P:

Kildor 18. September 2006, 15:44

:-D
nice, very nice…

GKiller 18. September 2006, 16:17

So the dot matches of course any character, and they forgot the $ at the end, and they could have set the i modifier :smile:

Did I forget something?

Where did the creator learn regular expressions? (or maybe he didn't at all :wink:

robodesign 18. September 2006, 19:17

lol

Now that's what I call Web 2.0!

xErath 18. September 2006, 19:50

That's some peculiar coding
function a(){
if(foobar)
return true;
else
return false;
}

function b(){
if( a() )
return true;
else
return false;
}

if( b() )
return true;
else
return false;

p:

gemsling 19. September 2006, 07:12

I'm guessing they're trying to determine whether a file is an image, but what happens when an image file has a different extension?

BTW, the sign-up process for Opera Community appears to be almost broken/inaccessible: a captcha is presented with mixed case letters, but I couldn't proceed until I entered lowercase equivalents. It should either accept input that exactly matches the captcha, or it should ignore case.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies