I'm learning regular expressions and want to help me to create a regular expression in JavaScript for the following situation:
1- I want detect when the user puts this in a textbox: "Please read out the results " or "can you please list the results ?"
The regular expressions must detect [read out|list] (any word) results
How can create this regular expression in JavaScript?
Thanks in advance!!!!
这个正则表达式应该工作:
/(read out|list) \w+ results/
这个:
((read out)|(list))([a-zA-Z ])*(results)
Maybe this one?
(read out|list)(.*?)(results)
This might work with your problem:
(?:^|\b)(read out|list)\s(\w+)\s(results?)(?:\b|$)
I added \\b at the begining to make sure it doesn't match with "playlist with result" for example
You can test it here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.