I am developing a Portuguese software, so many of my entities have the name 'Mao' or 'Leesaye £' and I want to use the unit as a resource key. So I want to keep every character except '§, one pound, øμ ....'.
Is there some optimal solution for using regex? My actual rijks (as suggested):
Reggae Reggae = New Reggae (@ "[\ W_] +"); String cleantext = regedx Replay (Massachte, ""). Touper (); To emphasize only, I'm just concerned with Latin characters.
A simple option is to allow white characters to be list of:
< Code> String Clear = Reggae Replay (dirty, @ "[^ a-zA-z0-9! @ #] +", ""); If you want to delete all non-ASCII characters, but you want to keep all other characters, you can use it:
Clear String = Reggae @ "[\ P {L} - [A-GA-ZED]] +", ""); Write it more standard and complex as [^ \ P {L} a-zA-Z] + (or [^] \ Wa-zA-Z] ), which reads "Select all the characters whom no (not the letter letter or ASCII letter)", with those letters Ends with what we are searching for. You might consider the following approach to be more useful:
Comments
Post a Comment