79549054

Date: 2025-04-01 19:54:27
Score: 1.5
Natty:
Report link

(.*) - $1 matches anything 0..m

\s* - whitespace 0..m

(?:

([+-]) - $2 Matches + or - once

\s* - whitespace 0..m

([1-9]\d{0,2}) - $3 Matches 1-9 then any digit 0to9 0 to 2 times

([dmyw]) - $4 Matches d or m or y or w once

)

?$ - which is to the end

friday+1d & 2/23/25+1d (works correctly)

$1 = Friday $2=+ $3=1 $4=d

$1=2/23/26 $2=+ $3=1 $4=d

friday+, friday+1 & 2/23/25+ no matches in $3 & $4

2/23/25 & March 23 no matches in $2, $3 or $4

March 23 + 1

March 23 + 1d

Adding

([+-]{0,1}) To $2 to match zero or once

([dmyw]{0,1}) to $4 match zero or once

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Ian Lowson