I want to remove the strings fa and fa-phone of the string: "fa famouse fa-phone".
I tried:
preg_replace('/fa.+$/','', 'fa famouse fa-phone');
But now it removes all strings with fa
.
I want to remove the strings fa and fa-phone of the string: "fa famouse fa-phone".
I tried:
preg_replace('/fa.+$/','', 'fa famouse fa-phone');
But now it removes all strings with fa
.
preg_replace('/fa[ \-](phone)?/','','fa famouse fa-phone');
Regex: https://regex101.com/r/bJ3nE7/1
fa
(literal)[ \-]
match a space or a hyphen(phone)?
match the literal 'phone' 0 or 1 times