1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-26 06:46:43 +00:00

Update regular expression comments in remove.

The regular expressions to which these comments apply were moved
around a few times without the comments being updated for these
changes.
This commit is contained in:
William Melody 2015-11-23 11:01:43 -08:00
parent e8e161f1e8
commit 279573d2d0

14
hosts
View File

@ -985,6 +985,11 @@ remove() {
_debug printf "remove() \$search_string: %s\n" "$search_string" _debug printf "remove() \$search_string: %s\n" "$search_string"
fi fi
# Regular Expression Notes
#
# Note double periods in regular expression in order to emulate /.+/,
# which apparently doesn't work properly with all versions of sed.
#
# IP / Hostname pair regular expressions: # IP / Hostname pair regular expressions:
local target_regex_ip_hostname_commented="^\(${search_ip}[${_TAB_SPACE_}]*${search_hostname}[${_TAB_SPACE_}]..*\)$" local target_regex_ip_hostname_commented="^\(${search_ip}[${_TAB_SPACE_}]*${search_hostname}[${_TAB_SPACE_}]..*\)$"
local target_regex_ip_hostname="^\(${search_ip}[${_TAB_SPACE_}]*${search_hostname}\)$" local target_regex_ip_hostname="^\(${search_ip}[${_TAB_SPACE_}]*${search_hostname}\)$"
@ -993,10 +998,6 @@ remove() {
local target_regex_commented_hostname="^\(..*[${_TAB_SPACE_}]${search_string}[${_TAB_SPACE_}]..*\)$" local target_regex_commented_hostname="^\(..*[${_TAB_SPACE_}]${search_string}[${_TAB_SPACE_}]..*\)$"
local target_regex_hostname="^\(..*[${_TAB_SPACE_}]${search_string}\)$" local target_regex_hostname="^\(..*[${_TAB_SPACE_}]${search_string}\)$"
# Regular Expression Notes
#
# - Note double periods in regular expression in order to emulate /.+/,
# which apparently doesn't work properly with all versions of sed.
local target_records local target_records
if ((is_search_pair)) if ((is_search_pair))
@ -1041,11 +1042,8 @@ remove() {
fi fi
# Regular Expression Notes # Regular Expression Notes
# #
# - -i '' - in place edit. BSD sed requires extension argument, for GNU # -i '' - in place edit. BSD sed requires extension argument, for GNU
# it's optional. More info: http://stackoverflow.com/a/16746032 # it's optional. More info: http://stackoverflow.com/a/16746032
#
# - Note double periods in regular expression in order to emulate /.+/,
# which apparently doesn't work properly with all versions of sed.
if ((is_search_pair)) if ((is_search_pair))
then then
sed -i '' \ sed -i '' \