express problem

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

express problem

Post by itsmani1 »

Hi want to fetch:
<font style="font-weight:bold;">Chicago Cubs</font> <br/>

vs

<br />
Milwaukee Brewers

Here is my code.

Code: Select all

            $title = '/<div class="listevent">(.*) <\/div>/';
            preg_match_all($title, $value, $mat);
It returns me empty array, any help

Code: Select all

<div class="list1">
    <div class="listevent"><font style="font-weight:bold;">Chicago Cubs</font> <br/>
    
        vs 
    
      <br />
      Milwaukee Brewers</div>
    <div class="listdate">March 4, 2008<br/>1:05 pm<br />
      <!--Tuesday, 7:05 pm--></div>
 
    <div class="listvenue">
        <strong>Hohokam Park</strong><br />
     Mesa, AZ         </div>
User avatar
HCBen
Forum Commoner
Posts: 33
Joined: Thu Jun 22, 2006 3:15 pm
Location: Indiana

Re: express problem

Post by HCBen »

You're close. You also need to add the appropriate modifiers.

Code: Select all

#<div class="listevent">(.*?)<\/div>#ism
Prost!
Ben
Post Reply