D
D
Dmitri19982021-10-07 19:49:34
Regular Expressions
Dmitri1998, 2021-10-07 19:49:34

How to make a selection of matches other than certain words or a word?

There is such an expression, but we need to find all words and numbers with _ in the text, but skip all words 'code'
How to make exceptions for one or more words?
/[\w\d\_]+/gi

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-10-07
@pacan4ik

/\b(?!code\b)\w+/gi
/\w+\b(?<!\bcode)/gi
Delete a few words.
/\b(?!(?:word1|word2|word3)\b)\w+/gi
/\w+\b(?<!\b(?:word1|word2|word3))/gi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question