m!\d+(/\d+)?! # Here, we use capturing parentheses for legibility m!\d+(?:/\d+)! # Noncapturing parentheses for programmer-ease