How do I match latin unicode characters in ColdFusion or Java regex? -


i'm looking coldfusion or java regex (to use in replace function) match numbers [0-9], letters [a-z], include none ascii portuguese letters (unicode latin, ç , ã).

some this:

str = rereplacenocase(str, "match none number/letter keep unicode latin chars", "", "all"); 

input string: "informação 123 ?:#$%"
desired outcome: "informação 123"

i know can match letters , numbers [a-z][0-9], doesn't match letters such ç , ã.

try alphanumeric character class: \w, should match letters, digits, , underscores.

also can use special named class \p{l} (i don't know, java regex parser support it). in c# task can done using following code:

var input = "informação 123 ?:#$%"; var result = regex.replace(input, @"[^\p{l}\s0-9]", string.empty); 

regex [^\p{l}\s0-9] means: character not in class (all letters, white space, digits). thereby matches in example ?:#$% , can replace these characters empty string.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -