preg_match to extract mailto on anchor

后端 未结 3 1420
清酒与你
清酒与你 2021-01-15 16:00

I need to get the email adress from an anchor with a mailto attribute with regex.

this pattern: (.*)

3条回答
  •  無奈伤痛
    2021-01-15 16:54

    Your delimiter is a quote ', and there are some instances of it in the regex:

    preg_match("'(.*)(.*)(.*)'si", "Some email", $matches);
                                          ^                                              ^
    

    Escape them (i.e.: \') or change your delimiter.

提交回复
热议问题