T
T
Tsuzukeru2021-05-24 14:40:42
Java
Tsuzukeru, 2021-05-24 14:40:42

How to compose a regular expression - the text does not contain a set of words: jpg,png,mp3?

How to compose (Java) regular expression - the text does not contain a set of words: jpg,png,mp3?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-05-24
@Tsuzukeru

This should work:
^((?!jpg|png|mp3)[\s\S])*$
Test:
Text contains png - https://regexr.com/5tja0
Text does not contain png - https://regexr.com/5tja3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question