Advertisement
Guest User

Untitled

a guest
Oct 24th, 2011
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. hey you guys, i need help with regular expression..basically im making an egrep for ip addresses, so i started off with [0-9]{1-3} now i know that isnt correct because ip addresses go up to 255 meaning the first number cant go over 2, but lets ignore that for now since im trying to solve something else...what im trying to do is the following...
  2.  
  3. lets say i want to match just the bracketed part "[]"
  4.  
  5. [192.]168.1.1 the egrep for this would be [0-9]{1-3}[.]
  6.  
  7. but now i want to repeat that twice to match
  8.  
  9. [192.168.]1.1 how would i do this? i tried putting the whole thing in() then appending {2} to it "([0-9]{1-3}[.]){2} but this wouldnt work....can someone show me the proper syntax?
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement