Bladeren bron

Simplify regexes

Previously we'd sometimes not match in certain cases where we should've.
Mark Rousskov 6 jaren geleden
bovenliggende
commit
dbfbe5c3cb
2 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 2 2
      src/handlers/assign.rs
  2. 1 1
      src/handlers/label.rs

+ 2 - 2
src/handlers/assign.rs

@@ -38,8 +38,8 @@ impl Handler for AssignmentHandler {
         };
 
         lazy_static! {
-            static ref RE_ASSIGN: Regex = Regex::new(r"\b/assign @(\S+)").unwrap();
-            static ref RE_CLAIM: Regex = Regex::new(r"\b/claim\b").unwrap();
+            static ref RE_ASSIGN: Regex = Regex::new(r"/assign @(\S+)").unwrap();
+            static ref RE_CLAIM: Regex = Regex::new(r"/claim").unwrap();
         }
 
         if RE_CLAIM.is_match(&event.comment.body) {

+ 1 - 1
src/handlers/label.rs

@@ -31,7 +31,7 @@ impl Handler for LabelHandler {
         };
 
         lazy_static! {
-            static ref LABEL_RE: Regex = Regex::new(r#"\b/label (\S+\s*)+"#).unwrap();
+            static ref LABEL_RE: Regex = Regex::new(r#"/label (\S+\s*)+"#).unwrap();
         }
 
         let mut issue_labels = event.issue.labels().to_owned();