I am trying to find all matches for the two following lines:
:Potato: Potato(3) :
and
:Tomato: 11
Of course these words (Potato,Tomato) can be random words and the numbers from 1-99 .
Any help would be very appreciated.
:[a-z]+:\h*(?:[a-z]+\([1-9]\d?\)\h*:|[1-9]\d?\b)
Explanation:
: # colon
[a-z]+ # 1 or more letter
: # colon
\h* # 0 or more horizontal spaces
(?: # non capture group
[a-z]+ # 1 or more letter
\( # opening parenthesis
[1-9] # digit between 1 and 9
\d? # 1 optional digit
\) # closing parenthesis
\h* # 0 or more horizontal spaces
: # colon
| # OR
[1-9] # digit between 1 and 9
\d? # 1 optional digit
\b # word boundary, make sure we haven't digit after
) # end group
Screenshot (before):
Screenshot (after):
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments