I might get arabic and/or chinese characters, and they would both be treated
in the same manner. So i thought, searching for the absence of english is
easier than searching for the presence of arabic or chinese.
Since preg_match isn't multi-byte safe, what other function would you
recommend?
On 5/28/07, Ala'a Ibrahim <[EMAIL PROTECTED]> wrote:
>
>
> Just a question, is there any character outside this group, you have
> put the whole characters there.
> just a note: preg_match is not a multi-byte function.
> anyway to match your set of characters you can use the regex
>
> /^[\w\s\$\(\)\*\+\-\.\?\[\]\{\}\\\^\N{exclamation-mark}\N{quotation-mark}\N{number-sign}\N{percent-sign}\N{ampersand}\N{apostrophe}\N{comma}\N{slash}\N{colon}\N{semicolon}\N{less-than-sign}\N{equals-sign}\N{greater-than-sign}\N{commercial-at}\N{circumflex}\N{grave-accent}\N{vertical-line}]*$/
>
> Note: regex expects this to be his final input, so you have to escape
> it for php, i.e. it would be:
> $regex =
> '/^[\\w\\s\\$\\(\\)\\*\\+\\-\\.\\?\\[\\]\\{\\}\\\\\\^\\N{exclamation-mark}\\N{quotation-mark}\\N{number-sign}\\N{percent-sign}\\N{ampersand}\\N{apostrophe}\\N{comma}\\N{slash}\\N{colon}\\N{semicolon}\\N{less-than-sign}\\N{equals-sign}\\N{greater-than-sign}\\N{commercial-at}\\N{circumflex}\\N{grave-accent}\\N{vertical-line}]*$/';
>
> this regex matches strings who only contains the chars you want. it
> would be false if a string contained any character outside your set
>
> On 5/28/07, Al-Faisal El-Dajani <[EMAIL PROTECTED]> wrote:
> > Hello all,
> > I'm writing a code that needs to search for certain characters. Thought
> of
> > doing it using regular expressions, only problem is i'm not good in
> using
> > them. So can somebody help?
> >
> > I need to search if a string contains any character that isn't within
> the
> > following list:
> >
> 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./?;:\'\"[]{}\\|[EMAIL
> PROTECTED]&*()-=_+<>\r\n`~
> > (and space)
> >
> > I'm using php's preg_match, which, as the documentation says here, uses
> > perl syntax in regular expressions (there are more than one??).
> >
> > Thanx for the help in advance.
> > --
> > Al-Faisal El-Dajani
> > Phone: +962-7-77 799 781
> > P.O Box: 140056
> > 11814 Amman, Jordan
> > >
> >
>
>
> --
> Ala'a A. Ibrahim
> http://guru.alaa-ibrahim.com/
>
> >
>
--
Al-Faisal El-Dajani
Phone: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Jolug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Jolug?hl=en-GB
-~----------~----~----~----~------~----~------~--~---