Regular expressions: Matching if number is greater then…?

前端 未结 4 1468
灰色年华
灰色年华 2021-01-16 03:03

I am in the need of an regexp that checks if one numerical value is greater then another value. Pretty much like I would by writing (if 10>8) ...

Cl

4条回答
  •  难免孤独
    2021-01-16 03:29

    Well if I'm understand correctly you've to compare these number inside an .htaccess or something like that. There's a stupid and unhealty way to do the compare, and require the numbers in the evaluated string: "^[0-9] [1-9][0-9]$" match if you compare "5 12" so you can understand that 5 is less than 12.

    Comparing number of same length isn't crazy only for numbers under 100.

    I think If you can explain better which is your context (iMacros, .htaccess...) someone can suggest a better way to do this.

提交回复
热议问题