Architect expression regex for +1XXXXXXXXXX to (XXX) XXX-XXXX

Trying to clean up incoming phone numbers in a Data Action before they hit the CRM. The source is sending E.164 format like +15551234567. Need it formatted as (555) 123-4567 for the legacy system.

I’ve been tinkering with the regex replace function in the expression builder but the grouping syntax is acting up. Here’s the expression I’m testing:

regexReplace({contact.phonenumber}, "^\\+1(\\d{3})(\\d{3})(\\d{4})$", "($1) $2-$3")

It’s returning null instead of the formatted string. The input definitely matches the pattern. Tried escaping the parentheses in the replacement string too but that just breaks the syntax validation.

Is the regex engine in Architect expressions different from standard JS or PCRE? Or is there a better way to substring this without regex? The docs are pretty light on edge cases for phone formatting.