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

  • Input (Input! A34 + Calc! D93): Input! A34, Calc! D93
  • Input! D343 = 1000: Input! D343
  • Calc! D71 = IF (HasValue (Input! D4), "FormIs (PartofReturn)", IFERROR (1/0)): Calc! D71, Input! D4

    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

    Popular posts from this blog

    excel vba - How to delete Solver(SOLVER.XLAM) code -

    github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

    ios - Replace text in UITextView run slowly -