Regex to remove blacklisted words from a sentence

前端 未结 3 1188
野趣味
野趣味 2021-01-21 01:34

How can I use a regext to filter out a list of blacklisted(Obscene) words, such that if a black listed words is like \'Bill Joseph\'

 Then \'I am Bill Josephine         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 01:56

    Make sure the word is surrounded by a word boundary ".*\\b" + badWord + "\\b.*"

提交回复
热议问题