Memory App

Optional items

Question mark

Question mark in colou?r means u optional. It is placed after the character that is optional. The u? part is always successful. This isn't to say that any regex that contains ? is always successful. For example, in colou?r against "semicolon", both "colo" and "u?" are successful, but r fails, so the whole regex fails.


Grouping for ? (and other similar metacharacters) is one of the main uses of parantheses. For example 4th|4 can be simplify to 4(th)?
Comments ...