posted 6 years ago

- 1

Let's have a look at the regular expression and break it up into parts:

So, this matches zero or more non-digits, followed by a "1" or "2", then two digits, then zero or more non-digits.

Note that you can find a description of regular expression syntax in the API documentation of class java.util.regex.Pattern.

p.s. "Hundred" is written with a "d" at the end, "Hundre

`[^0-9]*`This matches zero or more characters that are not digits.

`[12]?`This matches one character that must be 1 or 2.

`[0-9]{1,2}`This matches one or two characters that must be digits.

`[^0-9]*`This matches zero or more characters that are not digits (same as the first).

`[0-9]`means: characters in the range 0 to 9 (so, 0, 1, 2, ..., 9)`[^0-9]`means: all characters except those in the range 0 to 9`*`means: zero or more characters`?`means: exactly one character`{1,2}`means: between one and two characters (so, exactly one or two characters)So, this matches zero or more non-digits, followed by a "1" or "2", then two digits, then zero or more non-digits.

Note that you can find a description of regular expression syntax in the API documentation of class java.util.regex.Pattern.

p.s. "Hundred" is written with a "d" at the end, "Hundre

**t**" is wrong; also, it should have been "Than" instead of "Then"; "Then" means you're talking about time (in the past) -> isLessThanThreeHundred