Tuesday, August 30, 2011

Re: [android-developers] Re: Disabling a set of 'reserved characters' from user Input?

On 30 August 2011 11:57, bdk <mathieu.bosi@gmail.com> wrote:
> Ok, here some more resources:
>
> RegExp example:
>  http://www.devdaily.com/blog/post/java/remove-non-alphanumeric-characters-java-string
>
> Windows filenames & paths:
>  http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx


Good spot Mathieu about Unicode characters!

You have to build your reg-ex using character classes designed to deal
with this.

go to:

http://download.oracle.com/javase/1,5.0/docs/api/java/util/regex/Pattern.html#sum

...and have a look at 'Classes for Unicode blocks and categories' section.

\p{L}

as a reg-ex marks letters regardless of the alphabet/script used.


--
Daniel Drozdzewski

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment