No matter how much I try to learn RegEx and implement them, I fail.
Below : The first value is the input string, values after colon are the terms I require from the string. The term will always be -> either Input! (A-Z) (number) or Calc! (A-Z) (number)
e.g.Input!A34 or Calc!D93.
Input : Need to replace with some constant/val
What pattern should I use for this ?
My try :
Pattern findMyPattern = Pattern.compile("(?:Input|" + "Calc!"
+ ")![a-zA-Z]\\d+");
Matcher foundAMatch = findMyPattern.matcher(input);
HashSet hashSet = new HashSet();
while (foundAMatch.find()) {
String s = foundAMatch.group(0);
hashSet.add(s);
}
"Input![A-Za-z]+\\d+|Calc![A-Za-z]+\\d+"Will this solve your problem?(?:Input|Calc)![A-Z][1-9][0-9]*- either Input or Calc followed by ! and capital letter and, finally, the number