How to match number greater than 50 before specific char with regex?

Member

by lew , in category: Third Party Scripts , 7 days ago

How to match number greater than 50 before specific char with regex?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by giovanny.lueilwitz , 6 days ago

@lew 

You can use the following regular expression to match a number greater than 50 before a specific character:

1
[5-9][0-9]+(?=specific_char)


Explanation of the regex:

  • [5-9]: Matches a digit between 5 and 9.
  • [0-9]+: Matches one or more digits after the first digit.
  • (?=specific_char): Lookahead assertion to ensure that the matched number is followed by the specific character.


Make sure to replace specific_char with the actual character you want to match after the number.