nutballs

Normally I am the goddam

regex

  genious, but for some reason this is giving me a headache. I am trying to match content that has a long date like january 1st, 2007.


$regstr='#(?:January|March|April|May|June|July|August|September|October|November|December)W+d{1,2}.{1,4}d{2,4}#is';
if (preg_match($regstr,$s) != 0) echo 'date';


pass it this and it matches:
Posted Tuesday, November 20th, 2007 at 11:44 am Filed Under Category: awesome dude!

Pass it this and it doesnt:
morgan 13 November 20th, 2007 4 at 7 4:16 pm 5 2a 3c Ahh… so your phone DOES support MP3

dimitry12


if("morgan 13 November 20th, 2007 4 at 7 4:16 pm 5 2a 3c Ahh. so your phone DOES support MP3" =~ m/(?:January|March|April|May|June|July|August|September|October|November|December)W+d{1,2}.{1,4}d{2,4}/is){
    print "pass! ";
}else{
    print "no! ";
}'


prints "pass!"

nutballs

err... what the fish is that magic syntax you're using?

hmm. it passes? I wonder if those spaces are actually spaces. Obviously when I copy paste them into the forum they probably get converted somewhere along the lines. I gotta check that out.

thanks for testing it.

perkiset

Cripes Dim, I can't find that syntax anywhere - is that "=~" equal to a

regex

 ? I'm not at my

mac

 hine so I cant test...

Feckin'

learn

  something every day...

short outline please:


dimitry12

it's

perl

 , sorry Applause

chide

Yummy

perl

  Applause


Perkiset's Place Home   Politics @ Perkiset's