Are there any macOS Shortcut experts?
I’m trying to do a REGEX replace, to replace decimal commas in a CSV with periods. I have this REGEX in the replace action:
(?<=[0-9]+),(?=[0-9]+)
I have set the action to be case insensitive
Here’s the shortcut: https://www.icloud.com/shortcuts/6f9acd95ac194a08aee3cf6c99ff222c
In VSCode, it correctly finds the occurrences, but the Shortcut action doesn’t do anything
Anyone knows what’s up?
@davidbures Try
(?<=[0-9]),(?=[0-9])
or
(?<=\d),(?=\d)
because using + or * is not allowed in lookbehind in Shortcuts. And it works the same without the +’s anyway
@gluebyte Thank you, `(?<=\d),(?=\d)` worked. I wish there was documentation about what the REGEX engine supports.
@davidbures if I had to make a wild guess, I’d guess the shortcuts regex engine may not support look-behind assertions. Maybe try switching to a capturing group and replace both numbers (before and after) instead of trying to replace just the punctuation?
@gregatron5 It was a problem with the REGEX engine; I changed it to `(?<=\d),(?=\d)` and it worked.