Need Help in PHP Regex
Posted
by
amateurs
on Stack Overflow
See other posts from Stack Overflow
or by amateurs
Published on 2011-01-13T04:43:33Z
Indexed on
2011/01/13
4:53 UTC
Read the original article
Hit count: 164
I am studying about regex, i figured out some about matching one or more character, but i have a case, but don't know how to solve this..
For example i have:
$data = "bla bla -start- blu blu blu -end- bla bla";
$pattern = "/\-start\-[\w]\-end\- /";
preg_match($pattern, $data, $matches);
print_r($matches);
i intend to take anything between '-start-' and '-end-', so i expect to get
' blu blu blu '.
any suggestion ?
© Stack Overflow or respective owner