Need help with some Regex

So, I’m working on a workflow where I need to do the following:

  1. If the input follows any of the following patterns, the output should be everything but the brackets and the blank space.
    • (23.74859955,75.627388484)
    • (73.74748483, 2.748484884)
    • 54.7282882, 32.7383838
  2. Otherwise, perform Action 2

It’d be great if someone could help me achieve this.

[\(]?([0-9.]+)[,\s]*([0-9.]+)[\)]?

Lat will be in the first match variable (sometimes $1), and long. in the second.

You can test it at regex101.

Thanks. Any idea how do I validate a string against this regex in Shortcuts?

Hi shayonpal,

Along with JohnAtl’s regex, you should be able to use the “Match Text” action in Shortcuts to validate the input. Then you can use the “If” action to test that the input contains the “Text Matches” magic variable.

Does that capture what you’re trying to accomplish?

Clarke