cancel
Showing results for
Did you mean:
Silver

## Check calling number start with +1 and second digit is not 8 in CCX

Hi,

Is it possible to check if the ANI that is seen by the CCX script start with for example +1 and the second digit isn't an 8? We have today a section that looks like this with in an if statement.

ANI.startsWith("+10") || ANI.startsWith("+12")

What I'd like to achieve is something similar to what can be done in CM, aka match +1[^8] on for example TPs.

I'd also like to get input to if you can do this check in a more effective way or more to the point nicer looking from a script perspective. Today we have quite a large block of numbers within many different if statements that map to separate language sections later on in the script.

/Roger

1 ACCEPTED SOLUTION

Accepted Solutions
Green

## Hi,on second thought, this

Hi,

on second thought, this would be even better:

`ANI.matches("\\+1[^8].*")`

This would return `true` if the number starts with anything but +18, otherwise `false`.

G.

6 REPLIES
Green

## Hi,try!ANI.startsWith("+18")G

Hi,

try

`!ANI.startsWith("+18")`

G.

Silver

## Thanks Gergely,Super fast as

Thanks Gergely,

Super fast as ever.

Just to be clear, will that match all numbers that start with +1, but not +18?

/Roger

Green

## Hi,on second thought, this

Hi,

on second thought, this would be even better:

`ANI.matches("\\+1[^8].*")`

This would return `true` if the number starts with anything but +18, otherwise `false`.

G.

Silver

## Thank you Gergerly,This

Thank you Gergerly,

This sounds exactly as what I'm looking for. I will test it out on a test version of the production script and get back to you.

R

Silver

## Greg does that Regular

Greg does that Regular Expression actually work for you with the 2 Back slashes (in the version of CCX you are using)?..if so then in CCX 9.0.2SU1 that expression doesn't work..but it's not too far away from being "correct" (apparently as I read what you have there..you are "escaping the escape character").

`ANI.matches("\+1[^8].*")`

Just seeking clarification..

Silver

## The image demonstrates

The image demonstrates another method you could use..but if you ever have an ANI that looks like the following: +1754+18xxx then the logic breaks on this function..however, I don't know of any numbering plans that do things like the above...

323
Views
5