score:0

You could try the below regex which uses logical OR operator,

Messages\("(.*?)(?="\))|Messages\(([^)]*)

DEMO

Explanation:

  • Messages\("(.*?)(?="\)) Captures all the charcters after the string Messages(" only if it's followed by ")
  • | Logical OR operator.
  • Messages\(([^)]*) From the remaining strings, it captures all the characters after the string Messages(" until the ) is reached.

score:0

Messages\("([^"]*)"\)|Messages\((.*)\) should do the trick


Related Query

More Query from same tag