I’m not sure if this is your entire statement, but it looks like both the round and square brackets don’t have matching open/close states. Looks like you identified one square bracket condition, but I still think you have an extra closing round bracket as well.
I believe you are right, but fun fact is that on Windows version it worked just fine in that state.
I started to get errors after I migrated all my actions over to Mac version and I am currently in progress of rewriting and checking each one of them, as I have lots of regex related issues on Mac version at the moment.
All of those worked fine on Windows version.
I’m sure there are many more “fun” differences you will find. This is par for the course between operating systems. But I think if you start by correcting the context of your statements they will work more effectively across all. There may be some conditions in Windows that this may not produce correct results.