Syed Babu wrote:
I'm unable to understand how the s1.size and s2.size differs as both are searching for same match.
What do you mean, the same? The two regular expressions are clearly different.
s1.size() and s2.size() do not, I repeat do not, return the length of the match in characters (as you seem to assume, despite being told otherwise - twice). They return the number of submatches, which is one plus the number of capture groups in the regular expression. If you want the length of the match, that would be s1.length() and s2.length()
Igor Tandetnik