Need help for a regular expression

后端 未结 1 1729
野趣味
野趣味 2021-01-25 09:57

I have following sample string

test1/test2/test3:test4/test5/test6IAmInterestedIn:test7/test8

I am only interested in test6IAmInterestedIn

相关标签:
1条回答
  • 2021-01-25 10:07

    You can try this DEMO

    (?:[^\/]*\/){4}([A-Za-z]{3}[0-9]{3})
    

    where

    • (?:[^\/]*\/){4} matches 4 blocks that contain forward slash
    • ([A-Za-z]{3}[0-9]{3}) captures your desired pattern
    0 讨论(0)
提交回复
热议问题