From 1d1fa7ce9fc5e4e36afa281ff5ef644140e1292d Mon Sep 17 00:00:00 2001 From: William Melody Date: Sat, 12 Sep 2015 15:03:09 -0700 Subject: [PATCH] Match IP at start of line in `disable` The `disable` regular expressions avoid matching against commented lines by excluding '#' characters at the beginning of the line. However, the IP portion of the record is at the beginning of non-commented lines, so in order to match these IPs the `target_regex_ip` needs to have the search term checked against the beginning of the line. Therefore, the `[^#]` at the beginning of `target_regex_ip` must be removed to make `search_term` properly match these IPs. --- hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts b/hosts index ead8db7..ed5f0ad 100755 --- a/hosts +++ b/hosts @@ -731,7 +731,7 @@ disable() { else _debug printf "disable() \$search_term: %s\n" "$search_term" - target_regex_ip="^\([^#]${search_term}[${_TAB_SPACE_}]..*\)$" + target_regex_ip="^\(${search_term}[${_TAB_SPACE_}]..*\)$" target_regex_commented_domain="^\([^#]..*[${_TAB_SPACE_}]${search_term}[${_TAB_SPACE_}]..*\)$" target_regex_domain="^\([^#]..*[${_TAB_SPACE_}]${search_term}\)$"