Trying to extract substring after a particular code for example
String sample1 = "/ASDF/096/GHJKL/WER/WER/dv/7906/CODEM/TEAR1331927498xxxxxx/YUII/OPL";
String sample2 = "/CODEM/TEAR1331927498xxxxxx";
String regExpresssion = "[/CODEM/]{6}(^[a-zA-Z0-9|\\s])?";
final Pattern pattern = Pattern.compile(regExpresssion);
final Matcher matcher = pattern.matcher(sample1);
if (matcher.find()) {
String subStringOut = sample1.substring(matcher.end());
}
subStringOut for sample 1 > TEAR1331927498xxxxxx/YUII/OPL
subStringOut for sample 2 > TEAR1331927498xxxxxx
above code is working fine but now I need to add one more identifier '/CODER/' in regex expression for below sample
String sample3 = "/ASDF/096/GHJKL/WER/WER/dv/7906/CODER/TEAR1331927498xxxxxx/YUII/OPL";
I have tried
String regExpresssion = "[/CODEM/|/CODER/]{6}(^[a-zA-Z0-9|\\s])?";
but it is not working. Any suggestions guys?
Thanks!!