Test, validate and match regular expressions
This regex matches duration-like expressions with optional whitespace, numbers, and units (years/year/yrs/y/months/month/m), separated by an optional slash or dash. It is designed to validate strings that represent a time span, such as '2 years / 3 months - 1 year' or '1.5y-6m'. The 'i' flag makes unit matching case-insensitive, and 'g'/'m' flags allow global matching and multiline input, useful for scanning text in Java.