I am trying to extract from this type the line ou=persons,ou=(.*),dc=company,dc=org last line that immediately precedes coma , which is not followed by (. *). In the latter case, this should give dc=company,dc=org .
Looking at a regular expression, this seems like a positive look (ahead) of a negative look.
So, I achieved this regular expression: (?<=(,(?!.*\Q(.*)\E))).* , But it returns ,dc=company,dc=org with a coma. I want the same thing without a coma. What am I doing wrong?
source share