Reputation: 1181
I'm very weak in regular expressions.
I simply need to replace <
and >
(and anything between) with new content.
This is what I have:
$key = preg_replace('/<.*>/', '', $key);
My little string <5>
should simply be My little string
.
My little string <96>
should simply be My little string
.
What did I do wrong?
Upvotes: 0
Views: 739
Reputation: 2278
$key
needs to be equal to the string you are tring to replace in. There is nothing wrong with your regular expression.
Upvotes: 0
Reputation: 11591
The following works if you supply the string instead of $key
:
preg_replace('/<.*>/', '', 'My little string <96>');
What is the value of $key
?
Upvotes: 1