diff options
author | Erich Eckner <git@eckner.net> | 2018-06-28 13:43:19 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-28 13:43:19 +0200 |
commit | 97b4c81b374610948dab596acef5639264cee1cf (patch) | |
tree | 731df75fbfa8a4a1a4da6481fd6a147259474496 | |
parent | 7ea185038790d5081a4541f0399eed6a24f6a505 (diff) | |
download | builder-97b4c81b374610948dab596acef5639264cee1cf.tar.xz |
bin/ii-answer: clean up regexes
-rwxr-xr-x | bin/ii-answer | 10 |
1 files 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}" |