Q:

Regex match until first instance of certain character

I am trying to match a url up until a special character however the regex I am using is match the last instance when I need it to stop after the first instance. What am I doing wrong?!
.+?(?=\")

To match everything until first "
However my result is below:

A:

You added the " into the consuming part of the pattern, remove it.
.+?(?=\")

See demo. Here, .+? matches any 1+ chars, as few as possible, up to the first " excluding it from the match because the "` is a part of the lookahead (a zero-width assertion).
Best is to use a negated character class:
^[^"]+

See another demo. Here, ^[^"]+ matches 1+ chars other than " (see [^"]+) from the start of a string (^).

