# V6059. Odd use of special character in regular expression. Possibly, it was intended to be escaped.

The analyzer has detected a strange regular expression, the use of which leads to a result different from what the programmer expects.

Consider the following example:

    String[] arr = "Hot. Cool. Yours".split(".");

After executing this line, the array will be lacking the expected elements {"Hot", " Cool", " Yours"}. Instead, it will be an empty array. This has to do with the fact that the dot is a special character in a regular expression and has its own purpose. To make a dot a separator in your string, use it as follows:

    String[] arr = "Hot. Cool. Yours".split("\\.");

The analyzer will also warn you if your regular expression consists only of these characters:

- "|"
- "^"
- "$"

This diagnostic is classified as:

CWE-185