Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-28 13:43:19 +0200
committerErich Eckner <git@eckner.net>2018-06-28 13:43:19 +0200
commit97b4c81b374610948dab596acef5639264cee1cf (patch)
tree731df75fbfa8a4a1a4da6481fd6a147259474496 /bin
parent7ea185038790d5081a4541f0399eed6a24f6a505 (diff)
bin/ii-answer: clean up regexes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ii-answer10
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}"