Regular Expression.how to add optional character at end of regex Use ? at the end for characters: [A-Za-z]? This will match at most 1 presence of a character (lower or upper case).