I have a regular expression that match the string that contains the word "duration", followed by a
> operator and then a number. Here is the expression:
Is there any way I can make this expression better?
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It only takes a minute to sign up.Sign up to join this community
Since you only have two characters to compete with, namely,
>, use a character set. Other than that, you might consider
\d matching your digits, instead of
\d covers the numerical characters across the entire UTF8 range.
The final expression would be:
I've left the matching groups in place, considering that you might be referencing them in your later code.