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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -