regex - Groovy: Escaping an arbitrary (unknown) regular expression -


I want to split a string through String.split (k) where k is an arbitrary string (read from the input ). The problem is that Kashmir can be a string and thus regular expression operators may be included, such as: "* [" .

In such cases, the partitioned method leaves an exception because regular expression is not formed properly.

What I see is a way of avoiding any Kashmir, as a result that the string can be passed safely on the partition ().

Any thoughts?

You can use * to avoid the regex pattern.

*: 'Escapet' rather seems childish.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -