----- Original Message ----- 
From: "Bob"

Hi,
I'd like to let a regular link through:
http://www.mysite.com/section/page2-name.php

What I was doing is denying characters etc
if (preg_match('/[?&%=;]/', $addr)) exit;

But, the recommended way is to allow characters you want through
[a-zA-Z0-9 / : _ .-] thus blocking the rest.

I know some may need escaping, and the dash is awkward,
but I just can't seem to get it correct.
Thanks, Bob.
------------------------------
Hi Bob,
            It is much faster to do this sort of thing without REGEX -

if (strlen(strspn(strtolower($addr), 
"abcdefghijklmnopqrstuvwxyz0123456789/_.-")) != strlen($addr))
  {
  // exit; string not valid
  }

Thanks, Rob. 



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to