regex to match substring after nth occurence of pipe character

前端 未结 3 954
有刺的猬
有刺的猬 2020-11-30 12:51

i am trying to build one regex expression for the below sample text in which i need to replace the bold text. So far i could achieve this much ((\\|))

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 13:28

    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

提交回复
热议问题