-2

I want to match a url like "index.html\index_1.html\index_12.html\index_49.html\index_n.html and the n must <50 not be 50

JasonYun
  • 999
  • 2
  • 11
  • 15

3 Answers3

0

You can achieve this by using - index_[1-4]?\d\.html as your regex.

What this does is it first limits the first digit of two to the numbers 1-4 then accepts any other following digit. The ? makes it so that the digit may be skipped if it cannot be found

regex101 link - https://regex101.com/r/BwMCdu/1 which has a few examples

Karan Shishoo
  • 2,402
  • 2
  • 17
  • 32
0

Try the following:

(((index)|(index_[0-9])|(index_[0-4][0-9])).html)
Md Golam Rahman Tushar
  • 2,175
  • 1
  • 14
  • 29
0

You can use [1-4]?[0-9]

index.html\index_1.html\index_12.html\index_49.html\index_[0-4]?[0-9].html$

VinnieS
  • 85
  • 2
  • 12