Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONTHDAY must not require a leading zero for day-of-month < 10 #5

Closed
wants to merge 3 commits into from

Conversation

jsvd
Copy link
Member

@jsvd jsvd commented Jan 7, 2015

Migrated from: elastic/logstash#1353
More about the problem on: https://logstash.jira.com/browse/LOGSTASH-2199

@@ -48,7 +48,7 @@ URI %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})?
MONTH \b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\b
MONTHNUM (?:0?[1-9]|1[0-2])
MONTHNUM2 (?:0[1-9]|1[0-2])
MONTHDAY (?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])
MONTHDAY (?:(?:(0|\s)?[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So. of if you breakdown the original regexp by brancheS:

  • (?:0[1-9])
  • (?:[12][0-9])
  • (?:3[01])
  • [1-9]

This should already match single-digit month numbers.

Further, this patch makes a space part of the MONTHDAY match, which is not, in my opinion, the correct behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should already match single-digit month numbers.

Specifically, when I read this original regexp, I believe it would match single-digit numbers. If it doesn't, this is obivously a bug as you have reported, but I want to make sure we fix the bug which is located at the end of the old regexp, not the beginning.
Hmm...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I agree that the whitespace match probably should not be part of the MONTHDAY match.

On a side note, I think that the original:

(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])

is equivalent to the following:

(?:(?:0?[1-9])|(?:[12][0-9])|(?:3[01]))

I don't know if the shorter one is an improvement though.

@purbon
Copy link

purbon commented Sep 7, 2015

Closing this PR becuase of long staled pending CLA, opening #84

If the CLA is signed, more than welcome to reopen the PR and get this change in.

@purbon purbon closed this Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants