I want to change all matching events when the string starts. There is a usage case here: each match occurring must be removed to a non-matching string encounters . I am currently using this regular expression I just want to replace the matched stars in the beginning, if the match fails once, then it should not change anything, any suggestions to help? Thanks You can capture string instead of preg_replace: the only capture In the group that string is included, see again. In addition, I've found that your input string contained PHP code (I'm not very familiar with the language, but I believe this should work): www.example.com/example.com/http://example.com/www.abc.com/www.example.com/xyz.com/example.com Should www.example.com / xyz.com / example.com
preg_replace to me
'/ (http: \ / \ /) {0 The problem is that it replaces all the mailing strings. {0}
(? :(?: Www .http :? \ / \ /)? Example \ .com \ /) + (. *)
http :: and I got it in the rags with a
? With and last thing,
{0}} to
? Can be written as . It is small :)
preg_match ('/ (?: (?: Www .http:? \ / \ /)? Example \ .com \ /) + (. *) / ', $ Html, $ match); $ Url = $ match [1];
No comments:
Post a Comment