Thank you. The bug can be closed then and I will make sure I have enough slashes coming through. The query originates in a Java string, meaning it will be eight trailing slashes to match.
postgres=# select '$.field ? (@ like_regex "a\\")'::jsonpath; -- does not work ERROR: invalid regular expression: invalid escape \ sequence LINE 1: select '$.field ? (@ like_regex "a\\")'::jsonpath;
It is working just fine. It sees both the regex and the backslash character and then helpfully tells you that the regex you wrote is bogus since the backslash you wrote isn't escaping anything.
If you need a literal backslash in a jsonpath string literal you need to write four of them. Each pair leaves one \ in the regex and then \\ in a regex is just a literally matched character.