I am looking for a pattern that matches everything until the first occurrence of a specific character, say a ";" - a semicolon.
I wrote this:
/^(.*);/
But it actually matches everything (including the semicolon) until the last occurrence of a semicolon.
/^(.*?);/
should also work (it's called non-greedy), but the given answers using[^;]*
are better. – Pascal\w+(?!([^]+;)|;)
but this doesn't why?.+(?!([^]+;)|;)
– Muhammad Umer