useDelimiter()
methods are used to tokenize the Scanner input.
In computer programming, a delimiter
is a character that identifies the beginning or the end of a character
string . The delimiting character is not part of the character string.
In command syntax, a space or a backslash () or a forward slash (/) is
often a delimiter, depending on the rules of the command language. The
program interpreting the character string knows what the delimiters are.
Delimiters can also be used to separate the data items in a database (the columns in the database table) when transporting the database to another application.
abc… Letters
123… Digits
\d Any Digit
\D Any Non-digit character
. Any Character
\. Period
[abc] Only a, b, or c
[^abc] Not a, b, nor c
[a-z] Characters a to z
[0-9] Numbers 0 to 9
\w Any Alphanumeric character
\W Any Non-alphanumeric character
{m} m Repetitions
{m,n} m to n Repetitions
* Zero or more repetitions
+ One or more repetitions
? Optional character
\s Any Whitespace
\S Any Non-whitespace character
^…$ Starts and ends
(…) Capture Group
(a(bc)) Capture Sub-group
(.*) Capture all
(ab|cd) Matches ab or cd
source: link