Make this regex more efficient?
Posted: Thu Jun 30, 2005 12:45 pm
Hi all,
I've successfully built a regular expression, but I'm quite the neophyte when it comes to these things. I was wondering if there was a more efficient pattern that could be employed here.
pattern: "/([0-9]{2,3}.{1}[0-9]{3}.{1}[0-9]{2,3}.{1}[0-9]{1,3}).*[0-9]+.*[0-9]+[^0-9]+([0-9]+)/"
target: "10.131.255.255 7625 0 11928"
I want to get the ip and the last number (in this case 11928).
I know that this pattern won't match ALL ips, but the ips I'm going to be dealing with are very regular, and will fit into this pattern.
Any ideas? Thanks.
I've successfully built a regular expression, but I'm quite the neophyte when it comes to these things. I was wondering if there was a more efficient pattern that could be employed here.
pattern: "/([0-9]{2,3}.{1}[0-9]{3}.{1}[0-9]{2,3}.{1}[0-9]{1,3}).*[0-9]+.*[0-9]+[^0-9]+([0-9]+)/"
target: "10.131.255.255 7625 0 11928"
I want to get the ip and the last number (in this case 11928).
I know that this pattern won't match ALL ips, but the ips I'm going to be dealing with are very regular, and will fit into this pattern.
Any ideas? Thanks.