S
S
Sounryyy2021-10-14 14:01:46
Regular Expressions
Sounryyy, 2021-10-14 14:01:46

Regular expression. How to catch a substring?

Guys, I'll ask for help with the compilation of the regular season.
Examples:
hello-blocked.svg
helloworld-blocked.svg
other.svg

Match (.svg) should only catch other.svg

Regular should catch a match in .svg only for anyname.svg
And shouldn't catch any line if at the end of it there is an expression -blocked.svg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vreitech, 2021-10-14
@Sounryyy

^.*(?<!-blocked)\.svg$

A
Alexandroppolus, 2021-10-14
@Alexandroppolus

what programming language? if js then
/^(?!.*-blocked.svg$).*\.svg$/

V
Viktor Taran, 2021-10-14
@shambler81

Here is another option, in my opinion the easiest.
https://regex101.com/r/yhD3Av/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question