Goal
Compare two substrings separated by a /
:
/
._
and -
in addition to numbers and letters.Original String Structure:
text1/text2
Rules
Examples
Input: ABC-ABC/ABC-ABC
Since text1 == text2, the output is empty.
Input: ABC-ABC/DEF-DEF
Since text1 != text2, the output is DEF-DEF.
I have tried this ((\w+)(?=\/\2))
, however, it has the opposite logic of what I need. This wil work in my program:
https://regex101.com/r/jMqT0Z/1
I thought this should work ^([^\/]+)\/(?:\1$\r?\n?)?
; the logic is right according to regex101. But it will not work/run in my program.
https://regex101.com/r/cLTHNZ/1
References:
The program that the regex will run on is EPLAN: https://www.eplan.help/ko-kr/Infoportal/Content/EECPro/2.8/EPLAN_Help.htm#htm/refregex_r_regular_expressions.htm
The sources/rules should be these: https://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html https://docs.oracle.com/javase/tutorial/essential/regex/
In EPLAN, there is a prefix/syntax that needs to be correct. This is what it looks like in the program: ○│??_??@^([^\/]+)\/(?:\1$\r?\n?)?;│