how to match everything before a special character regex code example Example: regex match to first instance /[^;]*/ # matches every character before the first ;