Error parsing regexp: invalid or unsupported Perl syntax: `(?<`

Viewed 40

I'm getting an error when trying to parse the following regex expression with com.google.re2j library(v1.6)

(?<=cif:).*(?=(.+?){4})

Expectation is to match part of the json value, leaving the last 4 characters.

cif:test1234

Matched value will be test

The error I am getting is

ch.qos.logback.core.joran.spi.ActionException: com.google.re2j.PatternSyntaxException: error parsing regexp: invalid or unsupported Perl syntax: `(?<`

I want to know the re2j equivalent of the above regex.

Note: I have to stick to the re2j library since. It's being internally used by a propriotery log masking framework in the organization whick I don't have access to.

0 Answers
Related