regex - Selecting text from between two separate strings + php -


I have a string of data, and I want to remove content between two blocks of text using PHP. Here's an example:

"dataset123"

The text I want is here.

"Endfile"

I want everything in between them, two quoted price values ​​will not change, so they can be hard coded.

Any thoughts? I have tried to find something like this, I'm sure that I will have to use str_match and regex, but I'm not sure how to do this about it.

Thank you! John

  preg_match ('! Dataset123 (. *) Endfile! S', $ string, Matches $); Var_dump ($ matches [1]); Or $ start = strpos ($ string, 'dataset 123'); $ End = strpos ($ string, 'endfile'); Var_dump (substr ($ string, $ start + 10, $ end - $ start - 10));  

ps: Because of that limiter, there are continuous liters - I've used 10 constant as a string length


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -