apex – Regex / Pattern, Matcher – Exclude a specific Match
Related to the matching of IBAN Numbers: Given this regex pattern ((?:DE)[0-9]{20})
is there a way to exclude specifically the IBAN Number e.g. DE02120300000000202051
directly in the regex pattern or do I have to exclude it e.g. in the while loop for example. Which route would you suggest. Thank you!
private static final String IBAN_PATTERN = '((?:DE)[0-9]{20})';
Pattern MyPattern = Pattern.compile(IBAN_PATTERN);
Matcher MyMatcher = MyPattern.matcher(String);
while (MyMatcher.find()) {
System.debug('check ' + MyMatcher.group(1));
}
Read more here: Source link