Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

detecting internaltional characters

Last post 07-25-2008, 11:09 AM by paulhuband. 4 replies.
Sort Posts: Previous Next
  •  07-24-2008, 2:43 PM 44534

    detecting internaltional characters

    I want to write a regex for first and last names, that will allow international characters such ass accented letters, and letters with omlaus(??)

     ex Černe, LindstrÖM, LaramÉE

     I am writing in php5 using ereg()

     

    Hope this isn't too simple.

     

    Thanks and Cheers in advance for any help.

  •  07-24-2008, 3:19 PM 44536 in reply to 44534

    Re: detecting internaltional characters

    Do you want to do anything with the matched characters?

    Which characters exactly?  Refer to an ASCII chart if necessary:

    http://www.asciitable.com/


  •  07-25-2008, 10:29 AM 44569 in reply to 44536

    Re: detecting internaltional characters

    I don't want to do anything in particular with the characters.

    I want all international latin based characters to be allowed to pass through the regex which is being used as a filter for people creating a profile on our site.

    I am implementing strict data screening/filtering in to prevent unwanted data in the DB, but I want to allow given and family names with international characters to pass.

    I tried a reverse filter to disallow all non - alphas, but ereg() still filters the international characters.

    Thanks

  •  07-25-2008, 10:49 AM 44571 in reply to 44569

    Re: detecting internaltional characters

    This loosely fits what I understand your requirement to be:

    [^\xC0-\xFFA-Za-z`-]

    But certainly you will find some unicode character(s) not in that set that someone somewhere will enter for their name, I guess if you don't need to support unicode then the above might be a good starting point.

    Use preg_match instead of ereg, if your platform is PHP preg_ functions are faster.


  •  07-25-2008, 11:09 AM 44573 in reply to 44571

    Re: detecting internaltional characters

    Thanks for the advice - its got me going in the right direction.

     

    Cheers

View as RSS news feed in XML