Regular expression help

1 replies
Am trying to get tags that start
<a has what ever in between, doesn't include a string and has an end </a> |

my code is

preg_match_all("/<a.*(?<!name\.cfm)</a> |/", $html, $matching_data);

the ending parameter </a> | seems to grab loads of line breaks, the (?<!name\.cfm) just doesn't seem work as code grabbed my the reg expression contains name.cfm.


Any ideas?
#expression #regular
  • Profile picture of the author Spencer Westwood
    Originally Posted by some_guy View Post

    Am trying to get tags that start
    <a has what ever in between, doesn't include a string and has an end </a> |

    my code is

    preg_match_all("/<a.*(?<!name.cfm)</a> |/", , );

    the ending parameter </a> | seems to grab loads of line breaks, the (?<!name.cfm) just doesn't seem work as code grabbed my the reg expression contains name.cfm.


    Any ideas?
    Try escaping the backslash

    preg_match_all("/<a.*(?<!name\.cfm)<\/a> |/", $html, $matching_data);

    Can't test it right now for you... just a thought.
    {{ DiscussionBoard.errors[256731].message }}

Trending Topics