I need to write a JavaScript RegEx that matches only the partial strings in a word.
For example if I search using the string 'atta'
it should return
true for khatta
true for attari
true for navrattan
false for atta
I am not able to figure how to get this done using one RegEx. Thanks!
You want to use a non-word boundary \B
here.
/\Batta|atta\B/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With