Need to convert +1XXXXXXXXXX to (XXX) XXX-XXXX in an Architect expression. Tried {{fn:regexReplace(inboundPhone, "^\\+1(\\d{3})(\\d{3})(\\d{4})$", "($1) $2-$3")}} but it returns null. The regex seems correct in online testers. What’s the syntax issue here?
Try stripping the plus sign first. Architect’s regex engine sometimes balks at the leading + without explicit escaping in the input string.
{{fn:regexReplace(fn:replace(inboundPhone, "+", ""), "^(\\d{3})(\\d{3})(\\d{4})$", "($1) $2-$3")}}