Originally posted by Suman Sharma:
Can anyone explain the meaning of the following pattern?
"^\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S.*)$"
Thanks.
This regular express will match ... the beginning of input, followed by zero or more whitespaces, followed by one or more digits (0-9), followed by one or more whitespaces, followed by one or more digits (0-9), followed by one or more whitespaces, followed by one or more digits (0-9), followed by one or more whitespaces, followed by a character that is not a whitespace, followed by zero or more of anything, followed by end of input.
Also, while this matching is taking place, place certain pieces in groups. This is so that these fields can be extracted after a successful match. The first group is the first set of one or more digits. The second group is the second set of one or more digits. The third group is the third set of one or more digits. And the last group is the a character that is not a whitespace, followed by zero or more of anything, at the end of input.
Henry