Back
Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input.
You can try this for the Java 1.5, and above:
Pattern.quote("$5");
31k questions
32.8k answers
501 comments
693 users