Skip to content
accelerando

Today: Fun with Unicode, Regex and Java.

Some would say, i have 3 problems ;)

private final static Pattern placeholder = Pattern.compile("#\\{(\\w+?)\\}");

won’t match “Mot#{รถ}rhead” for example.

To replace the word character \w you either need the list of possible unicodeblocks like [\p{InLatin}|\p{InEtc}] (you get the codes for the blocks through “Character.UnicodeBlock.forName” or you’re lazy like me and just use the dot:

private final static Pattern placeholder = Pattern.compile("#\\{(.+?)\\}");

Oh what a day… :/

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

*