#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    117
    Rep Power
    11

    match leteers and -'


    Hi I need to match A-Z and hyphen and or apostrophe.

    I have tried all combinations. The latest is

    if(preg_match('/[^\x41-\x5A\-\']/', $surname))

    I used \- and \' as I assumed (-) it is only valid for ranges.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    117
    Rep Power
    11
    Originally Posted by Otuatail
    Hi I need to match A-Z and hyphen and or apostrophe.

    I have tried all combinations. The latest is

    if(preg_match('/[^\x41-\x5A\-\']/', $surname))

    I used \- and \' as I assumed (-) it is only valid for ranges.
    What I have is this
    '/^[A-Z][\'|A-Z][-|A-Z]{6}/i'

    But I don't want {6} I want to the end of the string.
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,128
    Rep Power
    9398
    $ marks the end of the string. You'll probably still need some repetition though, even if not a {6}.

IMN logo majestic logo threadwatch logo seochat tools logo