cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1479
Views
0
Helpful
8
Replies

VCS Regex help, Matching on anything that Doesn't lead with 11 or more digits

jjlatessa
Level 1
Level 1

Hello,

 

I've created some pretty complex regex in my day but this one has me stumped.

 

In an effort to stop toll fraud attempts, I would to change a search rule on my VCS-E from "any alias" to a regex which will match "anything that does not lead with 11 digits".

 

First I tried with: [^\d{10,}] but you can't use special characters inside the [] as they are taken literally.

So 

I've tried using the Negative lookahead: (?!\d{11,}) and tried with the ^ in there: (?!^\d{11,})

No luck there either.

 

Any ideas?

 

 

8 Replies 8

Patrick Sparkman
VIP Alumni
VIP Alumni

Do you want to limit the number 11 specifally, or any repitition of the number 1?

I just tested, and if you want to prevent calls from just the number 11, you can use (?!11).*, it's a negative lookahead.  if you want to limit a scope of numbers, than it might take some more work, that is if it's possible.

Pat,

Thanks for your reply.

 

I'm not looking to limit the number 11 or 1, but rather 11 or more digits.

So a dial of 1234567890@domain would pass the traversal zone, but a dial of 12345678901@domain would not.

 

Right now I set a transform to match on anything 11+ digits: \d{11,}.* and replace with TollFraud

Then in my traveral search rule I use the forward lookup (?!TollFraud).* to skip anything that leads with TollFraud.

It works but I wanted it to be cleaner with a single rule. 

You can try setting your search rule to use (?!\d{11}).*, this will match anything that is under 10 numbers, anything 11 or over the match will fail.  Since the match will fail, it should prevent the search.

jjlatessa
Level 1
Level 1

Ah!

I figured it out!

(?!\d{11,}).*

 

Looks like I needed the .* on the back to match the rest of the dial attempt, doh!

 

Thanks!

Good!  You beat me to it, I hit reply right as your message came in.
 

Remove the , that is in your regex though.

(?!\d{11,}).*

I need the , as {11} is 11 and {11,} is "11 or more" which I learned today from:

http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

 

Hello jjlatessa/Patrick,

 

I want to implement similar changes in my expressway to avoid toll fraud, only 2-7 digit allowded followed by uri/IP ( Eg. 3232323@123.32.3.2  or 3232323@domain.com) .

 

can you please help me out.

 

Currenlty we are using below rules in Expressway E - > attached.

 

Please share me snap if possible .

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: