My input is the following string:
"<div>content <label class=\"ph\">$data</label> <label class=\"ph\">$data</label> <label class=\"ph\">$data</label> more content</div>"
(Where instead of $data there might be any string)
And my required output is:
"<div>content REPLACED <label class=\"ph\">$data</label> <label class=\"ph\">$data</label> more content</div>"
Basically, replacing just the first occurrence of a pattern like:
String regex = <label class=\"ph\">.*</label>
But when trying to use:
Pattern.compile(regex).matcher(contentInput).replaceFirst("");
I'm getting:
"<div>content REPLACED more content</div>"
Any Ideas of the correct regex to use, or any other idea? Thanks!