Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am looking for negative matching for the below IP based regular expression:

True-Client-Ip: (25[0-5]|2[0-4][0-9]|[0-9]|[01]?[0-9][0-9]?).(25[0-5]|[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?$)

I have tried with putting negation ?! but that is not working.

share|improve this question
    
What regex engine are you using? ! is the classic negation char, but regexes tend towards greediness. –  NickW Feb 24 at 9:45
    
The aren't simple solution for negative regexp. Extremely huge solution exists, but this is surely not what you want. (It were at least more thousands of chars). You should solve this out of the regexp mechanism (f.e. some !match or some like this). –  Peter Horvath Feb 24 at 10:20
    
Actually, it is a custom device which uses regex. I am testing with ! will update if it works fine –  Kunal Sharma Feb 24 at 11:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.