How to use preg_match to extract data?

前端 未结 5 1957
无人及你
无人及你 2021-01-07 04:21

I am pretty new to the use of preg_match. Searched a lot for an answer before posting this question. Found a lot of posts to get data based on youtube ID etc. But nothing as

5条回答
  •  不要未来只要你来
    2021-01-07 05:01

    You can try this:

    preg_match('~(?<=\[#)\d+(?=])~', $txt, $match);
    

    (?<=..) is a lookbehind (only a check)

    (?=..) is a lookahead

提交回复
热议问题