Here's an input HTML string:
<p>Johnny: My favorite color is pink<br />
Sarah: My favorite color is blue<br />
Johnny: Let's swap genders?<br />
Sarah: OK!<br />
</p>
I want to regex-match the bolded part above. Basically put, find any matches between ">" (or beginning of line) and ":"
I made this regex (?>)[^>](.+):
but it didn't work correctly, it bolded the parts below, including the <p> tag. I don't want to match any HTML tag:
<p>Johnny: My favorite color is pink<br />
Sarah: My favorite color is blue<br />
Johnny: Let's swap genders?<br />
Sarah: OK!<br />
</p>
I am using Java, with code like this:
Matcher m = Pattern.compile("`(?>)[^>](.+):`", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL).matcher(string);