Regex for Replace everything after second occurrence of character

If you want to get everything after second occurrence of a set character, in this example, we’ll use a dash, use this code.

Replace everything – after this – character

 

 

((.*?-){2}): matches and groups any number of any character zero or more times lazily within the current file (i.e. it matches the least times as possible, stopping when the following pattern starts to match) before a - character, twice

Result of this regex would be: Replace everything – after this –

 

Result of this regex would be: Replace everything – after this