Hi.
First, inspect these two links:
1,
2(scroll to "Regular Expressions, Literal Strings and Backslashes").
According to second link:
Quote:
In literal Java strings the backslash is an escape character. The literal string "\\" is a single backslash. In regular expressions, the backslash is also an escape character. The regular expression \\ matches a single backslash. This regular expression as a Java string, becomes "\\\\". That's right: 4 backslashes to match a single one.
|
So, "\\s" is the character class \s equal to [ \t\n\x0B\f\r] -- a whitespace character.
From the first link:
Quote:
Greedy quantifiers
X? X, once or not at all
.....
Special constructs (non-capturing)
(?:X) X, as a non-capturing group
|
Therefore (?:.*)? means optional (note second ?) block of zero or more arbitrary characters. Such non-capturing groups are used to improve performance.
The same with "(?:[Rr][Ee]:\\s*" + SUBJECT_PREFIX + " )?" -- optional block, for example "Re: <SUBJECT_PREFIX>" or "RE: <SUBJECT_PREFIX>" etc.
The only capturing group here is '([0-9A-Z]+)' -- one or more capital alphanumeric characters.
Hope, I am correct and this will help.