Creating a condition for a TIMER in a website

Hello There!

I have been trying to set a condition to activate whenever a timer inside a website goes above 02:00 (two minutes), however my condition doesn’t let me add time, i tried using regex to extract just the numbers from the website, and convert them to seconds only but that is not working either.

Has anyone done this before?

@poxtrek conditions don’t have an understanding of time or time interval. if the time is displayed in hh:mm format, can using the following regex work?

((0[2-9])|([1,2]\d)):\d\d

following chatgpt’s explanation:

Explanation

  1. Outer Parentheses ((0[2-9])|([1,2]\d)):
    This part groups the two main alternatives, making it easier to manage the overall structure and apply the | operator (logical OR).

  2. First Alternative (0[2-9]):

    • 0: Matches the character ‘0’.
    • [2-9]: Matches any digit from 2 to 9.
      This alternative matches times where the hour is a single digit hour but starts from 02 to 09.
  3. Second Alternative ([1,2]\d):

    • [1,2]: Matches either ‘1’ or ‘2’.
    • \d: Matches any digit (0-9).
      This alternative matches times where the hour is a two-digit number between 10 and 29.
  4. Colon ::
    This matches the literal character ‘:’ separating hours and minutes in time notation.

  5. Minutes \d\d:

    • \d: Matches any digit (0-9).
    • Repeated twice to match exactly two digits.
      This matches the minutes part of the time, ensuring it is exactly two digits.

Putting It All Together

The regular expression ((0[2-9])|([1,2]\d)):\d\d matches times formatted as “HH:MM” where:

  • The hours (HH) can be:
    • From 02 to 09 (inclusive).
    • From 10 to 29 (inclusive).
  • The minutes (MM) can be any two-digit number from 00 to 59.

Examples

  • 02:00 (matches because 02 is in the range 02-09 and 00 is valid minutes)
  • 15:30 (matches because 15 is in the range 10-29 and 30 is valid minutes)
  • 22:59 (matches because 22 is in the range 10-29 and 59 is valid minutes)
  • 09:45 (matches because 09 is in the range 02-09 and 45 is valid minutes)

This regex is useful for validating time formats where hours can range from 02 to 29 and minutes can be any valid two-digit minute value.

1 Like