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

Duration Parser Fix. #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Duration Parser Fix. #5

wants to merge 2 commits into from

Conversation

velia-vito
Copy link

Straight from a GithubCopilot breakdown of the RegEx (because I'm too lazy):

\((\d{1,2}:\d{2})\)
  1. \( and \): These match the literal parentheses ( and ). The backslashes \ are escape characters that indicate the parentheses should be treated as literal characters rather than special regex characters.

  2. (\d{1,2}:\d{2}): This is a capturing group that matches the time format. Let's break this down further:

    • \d{1,2}: This matches one or two digits, representing the hour part of the time. \d is a shorthand for any digit (0-9), and {1,2} specifies that it should match between one and two digits.

    • :: This matches the literal colon : character, which separates the hours and minutes.

    • \d{2}: This matches exactly two digits, representing the minute part of the time.

In summary, this regex matches a time in the format of HH:MM or H:MM enclosed in parentheses. For example, it would match (12:34) or (9:45).

I removed the \( & \) so it parses time without the literal parantheses.

Straight from a GithubCopilot breakdown of the RegEx (because I'm too lazy):

```dart
\((\d{1,2}:\d{2})\)
```
1. `\(` and `\)`: These match the literal parentheses `(` and `)`. The backslashes `\` are escape characters that indicate the parentheses should be treated as literal characters rather than special regex characters.

2. `(\d{1,2}:\d{2})`: This is a capturing group that matches the time format. Let's break this down further:

    - `\d{1,2}`: This matches one or two digits, representing the hour part of the time. `\d` is a shorthand for any digit (0-9), and {1,2} specifies that it should match between one and two digits.

    - `:`: This matches the literal colon `:` character, which separates the hours and minutes.

    - `\d{2}`: This matches exactly two digits, representing the minute part of the time.

In summary, this regex matches a time in the format of HH:MM or H:MM enclosed in parentheses. For example, it would match (12:34) or (9:45).

I removed the `\(` & `\)` so it parses time without the literal parantheses.
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.

1 participant