Answer the question
In order to leave comments, you need to log in
Regular expression, after number, no letters?
It is necessary that the regular expression does not work if there is a letter after the number
example https://regex101.com/r/wqU35y/1
it is necessary that the text 2333a does not fall under the condition
Answer the question
In order to leave comments, you need to log in
option 1: "super-greedy search" - we fill the numbers into the piggy bank, take the result and add a check that there is no further letter. Here the trick is that there is no backtracking, the chain of numbers will roll back. There is no special syntax for "overgreedy" in JS, but perhaps your language does.
option 2: checking that the numbers are not followed by "numbers and then a letter"
Offhand, the first option looks faster, because there is a linear complexity, and in the second it seems to be quadratic (although one cannot say for sure: maybe the mechanism will somehow guess not to do it vlob )
(?=(\d+))\1(?![a-z])
(\d+)(?!\d*[a-z])
Alexandroppolus
(\d+)(?!\d*[az])
(\d+)(?!\d*\w$)
az I think you can safely change, well, add $ (?=\d+$)\d+
(?=\d+$).+
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question