spec36 Posted December 1, 2011 Share Posted December 1, 2011 I have a dns zone file that looks like this ;########AB####### AB1501 IN A 192.168.0.1 AB1502 IN A 192.168.0.1 AB1502 IN A 192.168.0.1 AB1502 IN A 192.168.0.1 I want to be able to cut out just the AB1501, AB1502, etc... as the names will be inserted into a database. I am using this preg_match command in a if statement preg_match("ab/i", $data) $name = substr($data, 0, 4); but my output also includes the ### line, so it looks like this ;### N AB1501 AB1502 AB1503 ;### N I need to not include the ";### N" lines. How can I exclude them in my preg_match statement? Any help would be greatly appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
spec36 Posted December 1, 2011 Author Share Posted December 1, 2011 Solved this by adding ^ for start off. preg_match("^ab/i", $data) Quote Link to comment Share on other sites More sharing options...
requinix Posted December 1, 2011 Share Posted December 1, 2011 FYI you mark topics as solved by hitting the button at the bottom-left of the page, just after the posts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.