i have a code like onclick=window.location='abc.html'> lala
, i want to make a regular expression to cut this to meet the following requirments:
- if there is a
>
then the result should be> lala
- if there is not
>
then the string will cut till the space and the result will only belala
i have done the following the preg_replace, but i am wrong, what is the problem?
$text=preg_replace('/(onclick)(.*?)(>|\s)/','',$text);