Get string using RegEx in Java -
I try unsuccessfully to learn and implement RegEx, I'm unsuccessful.
Below: The first value is the input string, following the colon values, I have the necessary conditions. Word will always be - & gt; Either input ! (AZ) (number) or Calc! (As) (number)
For example! A34 or Calc! D93.
Input: Need to be replaced with some static / Val
Which pattern should I use for this?
Try Me:
Find Pattern MyPattern = Pattern.compile ("(?: Input |" + "Calc!" + ")! [A-zA-Z] \\ D + "); Matcher foundAMatch = findMyPattern.matcher (input); Hashaseet hashset = new hashset (); While (foundAMatch.find ()) {string s = foundAMatch.group (0); HashSet.add (s); }
find pattern MyPattern = Pattern.compile ("(?: Input | | Calc) [AZ] \\ d + ");
Comments
Post a Comment