I need to write a regular expression so I could replace the invalid characters in user's input before sending it further. I think i need to use string.replaceAll("regex", "replacement")
to do that.
The particular line of code should replace all characters which are not unicode letters. So it's a white list of unicode characters. Basically it's validating and replacing the invalid characters of user's first name.
What I've found so far is this: \p{L}\p{M}
, but I'm not sure how to fire it up in regexp so it would work as I explained above. Would this be a regex negation case?