Regex expression for setting a timer -
okay i'm still learning regex , i'm making voice assistant phone , want accept of following:
set timer 5 minutes set timer 5 minutes set timer 5 minutes set goddamn timer 5 minutes set timer 5 minutes
basically want every word between set
, timer
.
i'm trying doesn't work.
set (the|a|.) timer [1-9]{1,} (minute|minutes)
another command canceling timer:
cancel timer timer cancel cancel timer
basically if words "cancel" , "timer" appear in combination in sentence should cancel timer.
any appreciated.
you... that:
set(.*?)timer [1-9]{1,} minutes?
this capture group catch anything. , ?
makes s
optional.
for other one, guess have like
(cancel).*?(timer)|(timer).*?(cancel)
Comments
Post a Comment