08-14-2014 12:24 PM - edited 03-18-2019 03:17 AM
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?
08-14-2014 12:46 PM
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.
08-14-2014 12:49 PM
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.
08-14-2014 01:04 PM
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.
08-14-2014 12:57 PM
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!
08-14-2014 01:01 PM
Good! You beat me to it, I hit reply right as your message came in.
08-14-2014 01:02 PM
Remove the , that is in your regex though.
(?!\d{11,
}).*
08-14-2014 01:57 PM
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/
10-20-2018 05:15 AM - edited 10-20-2018 05:19 AM
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 .
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: