0

I want to create a RegEx to search in JavaScript, the string I type is "AO it", so I want some sentences like "hit AO ah", "it AO",. Will be showed, I don't know how to do, and I wish when I type some special like ' (', '@#',... so it not show result. I try RegEx as '.*it.AO.' but not match.

2 Answers 2

1

Try this regex:

.*(AO it|it AO).*
Sign up to request clarification or add additional context in comments.

Comments

0

Let me submit a naive answer here as a baseline. Let's call "AO it" as the target.

Split target by space and you get a set of tokens. Then, show the user input if user input contains any of the element(s) in tokens.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.