Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Matching every second pattern

Last post 07-28-2010, 4:29 PM by Steele. 2 replies.
Sort Posts: Previous Next
  •  07-28-2010, 1:44 PM 70177

    Matching every second pattern

    Hello,

    I apologize if this was already posted here, I could not find it.

    I am struggling with a simple expression in php (preg_match_all) which seems to be matching every second occurrence:

    string: "<br>1<br>2<br>3<br>4<br>5<br>"

    reg. ex: /<br>(.*)<br>/siU

    This seems to be finding 1, 3 and 5, but I want it to match all strings between the "<br>" tags. It should return 1,2,3,4 and 5.

    Any ideas?

    Thanks.

  •  07-28-2010, 3:54 PM 70178 in reply to 70177

    Re: Matching every second pattern

    /(?<=<br>)(.*)(?=<br>)/siU

    http://portal-vreme.ro
  •  07-28-2010, 4:29 PM 70180 in reply to 70178

    Re: Matching every second pattern

    It works, thank you so much!
View as RSS news feed in XML