in reply to How to check CGI params in if/elsif

I have no idea how you're going to check for siteid.

Where are the directories you want to check against? Are you checking for them locally, or are you looking to see if there's a match with one of the elements of your array @directory? You can do the first check with -e and the second using a foreach to loop through each of the elements and test for equality.

I also notice that your E-Mail test would fail with any domain that has more than two parts .. better would be

/^\S+@\S+(\.\S+){1,}/
Suffice to say that it's impossible to write a regexp that parses E-Mail addresses.

--t. alex

"Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny

Replies are listed 'Best First'.
Re: Re: Help
by snowcrash (Friar) on Jun 11, 2002 at 08:27 UTC
    > I also notice that your E-Mail test would fail with any domain that has more than two parts ..
    Wrong, it would match because there is no anchor at the and of the regex. But the test is really bad anyway ...

    > Suffice to say that it's impossible to write a regexp that parses E-Mail addresses.
    See Jeffrey Friedl's regex that checks if an email address conforms to rfc822 published in Mastering Regular Expressions. IIRC that regex is about 6k characters long, it is also included in the module Email::Valid which I would recommend for checking email addresses.

    cheers,
    snowcrash
        > Suffice to say that it's impossible to write a regexp that parses E-Mail addresses.
        See Jeffrey Friedl's regex that checks if an email address conforms to rfc822 published in Mastering Regular Expressions. IIRC that regex is about 6k characters long, it is also included in the module Email::Valid which I would recommend for checking email addresses.
      Right, well of course, what I was implying was that it's impossible to write a *short* regexp that will accurately parse for a valid E-Mail address. Anything's impossible with enough code and horsepower to run it.

      I still maintain that in the context (code size, inferred experience level) of the original message, such a regexp is impossible.

      --t. alex

      "Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny