regex stop at first match code example
Example 1: regex find first instace
adding ".*?" To a answer makes it non greedy
running <h2)*?>
on
<h2 style="text-align: center;">heading</h2>
will return <h2 style="text-align: center;">
Example 2: javascript regex stop at first match
// Adding a ? on a quantifier (?, * or +) makes it non-greedy.
/location="(.*?)"/