regex match until first occurrence of word code example Example: regex match to first instance /[^;]*/ # matches every character before the first ;