Convert integer numeric interval to regex

后端 未结 3 1208
轻奢々
轻奢々 2020-12-06 21:48

SO,

I\'m looking for a solution about the problem - how to convert integer interval to regex. Suppose I have two numbers, A and B. Both of

3条回答
  •  旧巷少年郎
    2020-12-06 22:32

    Why use regex in this situation?

    I would just do this:

    boolean isBetween = num > A && num < B;

    (Code written in Java)

    Far easier, a regex like what you're asking for could be huge and using it in this situation would be pointless and inefficient.

    Good Luck.

    If you truly insist on using RegEx for this task, see this website, run the regex with verbose mode on and it will explain to you how the author's RegEx works.

提交回复
热议问题