Regex to find string between slashes

后端 未结 1 1207
夕颜
夕颜 2021-01-19 11:36

I am trying to write a regex (with very little luck) to capture a string that occurs between two slashes in a specific location within a larger string.

An example so

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 12:29

    You can use following regex :

    "^\/[^/]+\/([^/]+)\/"
    

    See demo https://regex101.com/r/jR9rV5/1

    [^/] is a negated character class which match any string except /.

    0 讨论(0)
提交回复
热议问题