PROGRAMMING

 
REMEMBERS




Last update:   29-10-2021

Variable names

Variable names are not allowed to begin with a digit.
 
[a-zA-Z_][a-zA-Z_0-9]*
Double Quotes    (2/3)

Double quotes

We match all characters except a double quote, and apply quantifier.
 
"[^"]+"
Time Of The Day    (3/3)

Time of the day

9:17 AM or 12:30 PM
 
([0-9]|1[012]):[0-5][0-9] (AM|PM)
00:01 to 23:59
 
[01]?[0-9]|2[0-3]:[0-5][0-9]

Details

Something like [0-9]?[0-9]:[0-9][0-9] matches 9:17 or 12:30, but also allows 99:99 Looking at the hour, we realize that if it is a two-digit number, the first digit must be 1. But, 1?[0-9] still allows 19, which is wrong. We can use alternation for the hour part ([1-9]|1[012]).
Questions    
Non-capturing

        A B C D E F
🔔
1/2