\"and\")\" but this occurs several times in a body of text." />
开发者

How to get a substring throughout document knowing the markers?

开发者 https://www.devze.com 2023-02-28 07:14 出处:网络
I know the strings开发者_StackOverflow社区 in need lie between \"=t\\\">\"and\")\" but this occurs several times in a body of text.

I know the strings开发者_StackOverflow社区 in need lie between

"=t\">" and ")"

but this occurs several times in a body of text.

How can I extract between multiple instances of this occurence?

I have tried Explode, a variety of functions, preg_split, for 6 hours and only getting wrong results - Is it even possible?


Assuming your delimiters are =t\"> and ).

preg_match_all('/=t\\">([.\n]+?)\)/', $str, $matches);

var_dump($matches);

It sounds like you are trying to parse some HTML. Have you considered DOMDocument?

0

精彩评论

暂无评论...
验证码 换一张
取 消