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
1 |
(([^-]*-){2}) |
1 |
((.*?-){2}) |
((.*?-){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 –
1 |
^([^-]*-[^-]*)|.*$ |
Result of this regex would be: Replace everything – after this