I want to use regex to parse a huge String largeString.
I am using matcher.group() to obtain substrings of largeString. My question is:
Do matcher.group() returns a new String object, or it only returns a substring reference to largeString ?
As far as I know defining substring only allocates memory for a pointer and 3 int instances. I want to keep largeString for other purposes, so I will prefer keeping substring instances instead of creating new String.