Regular Expression for IP Range

We have a subnet of phones that all share the same username/password. I’m trying to add a regular expression so that the login shows up on all of the IP addresses. Can anyone figure out why my expression isn’t working?

The expression should include IPs: 10.10.0.10 - 10.10.0.254
This is the expression I’m trying to use: ^http://10.10.0.([1-9]\d|1\d\d|2[0-4]\d|25[0-4])$

You need to escape your forward slashes and dots:

^http:\/\/10\.10\.0\.([1-9]\d|1\d\d|2[0-4]\d|25[0-4])$

It looks like it works if I test it through regex101, however the extension still doesn’t show the credential when I access any of the pages. And just to note, I did a sync on the extension after updating it in the web vault.

Hi Paul - can you provide a screen capture of one of the URLs you are trying to match?

Strange Paul - I used Dan’s expression above and it works for me in BW.

I am sure you have done this, but it may be worth double checking that you have the URI type set to Regular Expression. Otherwise, I would scrutinize your URI entry to be sure there isn’t an unintended space or something in the string.

I double checked everything and it all looked good with no extra spaces. I then started by removing the ^ at the beginning at that didn’t work, but then I removed the ^ at the beginning and $ at the end. After that it appears to be working.

Thanks

3 Likes

I also had problems getting the regular expressions to work. Removing the ^ and $ also fixed the problem for me, but it would have been nice to be able to use them.

No, don’t escape the $ character. That’s part of regex syntax. And you definitely don’t want to remove the leading caret symbol (^) for security reasons.

If you are having trouble getting your expression to work, post your URI and your regex expression and someone here can help you troubleshoot. :+1:

Hi, I was trying to use this same expression but I am running into the same issue where I have to remove the ^$ The problem if I remove these characters, it does not restrict the range requested and works for all IP’s for 192.168.20.0/24. I have also tried different browsers to rule this out (Firefox and Brave).

Is there a solution for this?

IP Range: 192.168.20.20-245
^http://192.168.20.([2-9]\d|1\d\d|2[0-3]\d|24[0-5])$