asepm
asepm

Reputation: 71

preg_replace <*>

How do I change all occurrences of <*> in every line of a text file (a total of 5 <*> in every line) using preg_replace (substituting it with, say, |)?

My code is:

preg_replace("/<*\>/", "|", $text);

Upvotes: 2

Views: 415

Answers (1)

idmean
idmean

Reputation: 14865

You shoud escape the *

preg_replace("/<\*>/", "|", $text);

Upvotes: 5

Related Questions