Regular expressions(regex) in java are used for matching patterns in Strings.
The expressions \\s & \\ s+ both are used to match white spaces characters but they behave differently. \\s: This matches any single whitespace character which will include newline,unicode white space characters,spaces & tabs. \\s+ : This Matches one or more white space characters and the + quantifier means one or more of the preceding element.