I need regex expression that will replace all suffix "SJD" not preceded by prefix "/" to "OZPS" (and it must work with ant builder).
I cut few lines from my xml file with example occurrences:
input:
<replaceregexp flags="g" match="SJD" replace="OZPS" file="../ozps/build.xml"/>
<replaceregexp flags='g' match='"\/CAS\/SJD"' replace='"/CAS/OZPS"'>
<replaceregexp flags="g" match="SJD" replace="OZPS">
expected output:
<replaceregexp flags="g" match="OZPS" replace="OZPS" file="../ozps/build.xml"/>
<replaceregexp flags='g' match='"\/CAS\/SJD"' replace='"/CAS/OZPS"'>
<replaceregexp flags="g" match="OZPS" replace="OZPS">
I tried negative lookbehind assertion buit it seems not work.
EDIT: Small explanation for each who works with online regex testers. Most of them do not support negative lookbehind assertion because of java script regexp engine. Unlike JS, java engine seems to support NLA so if you test expression's dedicated for java I recommend to use this https://regex101.com