What is regular expression would I use to find the word “oy”? I need it to work in a userscript. Also, I have to make sure it doesn’t remove words that contain “oy”, like “Olive Oyl”.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need
/\boy\b/g.Explanation:
The
\bmeans word boundary (start or end of a word). Thegon the end means to search for more than one occurence (global). Finally, if you want the search to be case insensitive, add aniafter theg:To remove all “oy” words in a string
str, you do: