Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Regular expression for numbers between 300 and 500 except 499

I need a regular expression for numbers between 200 and 500 except 499, but I don’t know how to make that exception. It is for it’s a regular expression for fail2ban, can you help me?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

/[23][0-9]{2}|4[0-8][0-9]|49[0-8]|500/

If RegExp is what you want, this would be it. If you give us more context, maybe there are better ways for this check.

Another alternative is to explicitly exclude 499 as a match:

/(?!499)[2-4][0-9]{2}|500/
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading