Help needed with understanding (Java) Regular Expression
I'm maintaining a Java application that queries for email replies from an POP server. I have very limited knowledge interpreting regular expressions, and was wondering if someone could help me understand the following statement:
Code:
Pattern subjStart = Pattern.compile("^\\s*(?:[Rr][Ee]:\\s*" + SUBJECT_PREFIX + " )?([0-9A-Z]+)\\s*(?:.*)?"); |
Hi.
First, inspect these two links: 1, 2(scroll to "Regular Expressions, Literal Strings and Backslashes"). According to second link: Quote:
From the first link: Quote:
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. |
Quote:
Again, thanks for your help. |
All times are GMT -5. The time now is 08:45 PM. |