From 97b4c81b374610948dab596acef5639264cee1cf Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 28 Jun 2018 13:43:19 +0200 Subject: bin/ii-answer: clean up regexes --- bin/ii-answer | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/ii-answer b/bin/ii-answer index bc1784c..3f6f94e 100755 --- a/bin/ii-answer +++ b/bin/ii-answer @@ -42,10 +42,10 @@ find "${irc_dir}" \ sloppy_salutation='' fi # answer "why don't you?" - regex='^\(\S\+ \)\?\S\+ <\S\+> '"${prefix}"'!\?why[- ]don'"'"'\?t[- ]you \(build\|stabilize\|unstage\|keep\|stubbornly_keep\) ' + regex='^\S\+ <\S\+> '"${prefix}"'!\?why[- ]don'"'"'\?t[- ]you \(build\|stabilize\|unstage\|keep\|stubbornly_keep\) ' if grep -q "${regex}" "${out_file}"; then sed -i ' - s/'"${regex}"'/\2 / + s/'"${regex}"'/\1 / T w /dev/stdout d @@ -66,7 +66,7 @@ find "${irc_dir}" \ done fi # answer "wtf?" - regex='^\(\S\+ \)\?\S\+ <\S\+> '"${prefix}"'!\?wtf ' + regex='^\S\+ <\S\+> '"${prefix}"'!\?wtf ' if grep -q "${regex}" "${out_file}"; then sed -i ' s/'"${regex}"'// @@ -90,7 +90,7 @@ find "${irc_dir}" \ done fi # answer "What's up?" - regex='^\(\S\+ \)\?\S\+ <\S\+> .*[Ww]hat'"'"'\?s *[Uu]p' + regex='^\S\+ <\S\+> .*[Ww]hat'"'"'\?s *[Uu]p' if grep "${regex}" "${out_file}" | \ grep -q "${sloppy_salutation}"; then sed -i "/${regex}/d" "${out_file}" @@ -106,7 +106,7 @@ find "${irc_dir}" \ irc_say "${channel}" 'copy' fi # answer "Thanks!" - regex='^\(\S\+ \)\?\S\+ <\S\+> \(.* \)\?[Tt]h\(anks\|x\)\([ ,.!]\|$\)' + regex='^\S\+ <\S\+> \(.* \)\?[Tt]h\(anks\|x\)\([ ,.!]\|$\)' if grep "${regex}" "${out_file}" | \ grep -q "${sloppy_salutation}"; then sed -i "/${regex}/d" "${out_file}" -- cgit v1.2.3