I’m having some difficulties converting my python regex to javascript. If my needle was ‘apple’ or ‘#apple’, both case insensitive, I’d want to match any of the following from a haystack:
'apple', '#apple', ' apple', ' apple ', '#orange#apple'
Here is my python regex:
r"\b#?apple\b"
My feeble attempt at converting this to javascript was :
/\b#?apple\b/i
But it doesn’t seem to work. Can anyone help?
Put the word boundary
\bafter the#char: