Implement metacharacter '^' and '$', and reimplement metacharacter '*' '?'.