regex - Search for any word EXCEPT specific ones? -


i'm trying replace words plurals. know there multiple plural stems doing basic 's'. can make # of word-ending cases. purposes right i'd do:

(\w+\b) 

but have ignore either:

  • specific words
  • words end in specific letter(s)

so instance if had ignore \w+dy\b (e.g. study) , ignore words title|body find word except *dy, title, body

assuming have lookahead support can use regex:

\b(?!(title|\w*?dy)\b)\w+\b 

regex demo

body ends dy no need add in exception list.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -