Instead of using a regex and then check again, it would be better to directly check against strings in one single pass, just like in https://github.com/gatling/jsonpath/blob/master/src/main/scala/io/gatling/jsonpath/Parser.scala#L71