FreeSwitch Regular Expression not functioning as expected

Hey experts,
So i am very new to using regular expressions so please excuse my miss understandings.
So what i have is the expression below.  What i am trying to accomplish is...
IF a call from (+1 or 1) optional (999-999-9999) comes in then prepend Test- to the caller ID name.
IF MATCH Condition(All,Standard Information[Caller ID Number] = ^(\+1|1)?(9999999999)$,SIP Header Information[From: Display] = (.*)$) THEN
Export Variable[effective_caller_id_name]=TEST-$1
AND Continue
The question is with the variable.  In my example it works as desired.  but the variable i had to use was a $1.
My understanding of Regular Expressions would have told me.
$1 =  (\+1|1)
$2 = (9999999999)
$3 = (.*)

Each $number equals a value within the brackets.

So why in my setup if i use $1 do i get the desired results of "Test-Caller ID Name"
If i use $3 like i would have thought i should do i only get "Test-" no name or number to it.

Really just looking to see if anyone can clear this up for me.  I have read all over online and everything i can find tells me i should have used $3 to get the results and $1 should have returned non desired results.

Thank you
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
From what I see, you have 2 regular expressions and each has groups, so:
$1 =  (\+1|1)
$2 = (9999999999) and then

$1 = (.*)

Basically you're getting the first group from the second expression.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tsukrawAuthor Commented:
put me in the right direction.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.