regex to match substring after nth occurence of pipe character

To match part after nth occurrence of pipe you can use this regex:

/^(?:[^|]*\|){3}([^|]*)/

Here n=3

It will match 10.15.194.25 in matched group #1

RegEx Demo

Leave a Comment