anyone here know regexp?
I could need some hints for a school assignment
I'm trying to search a file for valid IP adresses
problem is, my script accepts a "fake one" (it will accept f.ex 123.456.789) and it obiously shouldnt, as each value cant be over 255
egrep '\<([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-5][0-5]|25[0-5]\.{3}[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-5][0-5]})\>' navn2.txt
the idea was to make it say:
"first seqence can't start with zero (hence the 1-9)
no sequence can be over 255 ([1-9][0-9]) would mean two digits, ranging from 10 to 99 , 1 [0-9][0-9] and 2 [0-5][0-5]should make it able to look for numbers up to 199 and 255 but not further"
but as it finds numbers far above that, clearly something's wrong