R
R
rgggwwg2021-03-02 18:09:07
linux
rgggwwg, 2021-03-02 18:09:07

How to use regular expressions to write "x" occurs more than 1 time in a row?

That is, so that the file with the name - site.com-1200x1600_67bd2cbd2fe26eab9480356a35c80eb9-1152x1536 matches the regular expression, and the file with the name - site.com-1200x1600_67bd2cbd2fe26eab9480356a35c80eb9 does not.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor Taran, 2021-03-02
@rgggwwg

x[^x].*x- like this
603e8bb0b2f53622710034.png
Under the same rule, it’s better to compose it so
if the resolution occurs twice
[0-9]+x[0-9]+.+[0-9]+x[0-9]+
603e8b102a206084925706.png
[0-9]+x- the numbers are 1 time and more
if the whole line
https://regex101.com/r/jJenlF/1

S
shurshur, 2021-03-02
@shurshur

For example, like this: x[^x]+x. True, depending on what is considered "not in a row", here is "xxx" - is it in a row or not?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question