MrBiggZ
12-17-2010, 04:19 PM
Hi!
I'm hoping there is a regex guru in the house. I've been getting pretty good at this on a novice level and now it's time to step up the game a little bit.
From this little section of HTML code below I'd like to pull the addresses out. I tried this:
#<div style="margin-bottom:.*?>\s(.*>)<br>\s(.*?)\s<br>\s(\d{3}-\d{3}-\d{4}\s<br>#m
Alas .. my results yield nothing =( I don know that the end of each line in the HTML is a LF not CR/LF. I did try using the s modifier instead of the m. Still no luck! Oh .. I'm using preg_match_all and not just preg_match
I've seen multi-lines done but it was congested with \/.*+ and other thing I couldn't follow it. If you could please help me with this one and break it down for me so I can under stand what is going on. I think once I get this one under my belt and I can follow it I can do others.
Hope you can help! I'll consider if an xmas present! =) Probably the only one I'll be getting this year! :eek:
Thanks much in advance!
<div id="directions">
<div class="item">
<div class="number">1</div> Steak 'N Shake
<div style="margin-bottom: 20px;">
3810 W. Washington<br>
Indianapolis, IN 46241 <br>
317-241-0483 <br><br>
Hours: <br>
Dining Room:
<div>Monday: Anytime</div>
<div>Tuesday: Anytime</div>
<div>Wednesday: Anytime</div>
<div>Thursday: Anytime</div>
<div>Friday: Anytime</div>
<div>Saturday: Anytime</div>
<div>Sunday: Anytime</div>
<div class="show">Drivethrough: </div>
<div class="show">Monday: </div>
<div class="show">Tuesday: </div>
<div class="show">Wednesday: </div>
<div class="show">Thursday: </div>
<div class="show">Friday: </div>
<div class="show">Saturday: </div>
<div class="show">Sunday: </div>
</div>
I'm hoping there is a regex guru in the house. I've been getting pretty good at this on a novice level and now it's time to step up the game a little bit.
From this little section of HTML code below I'd like to pull the addresses out. I tried this:
#<div style="margin-bottom:.*?>\s(.*>)<br>\s(.*?)\s<br>\s(\d{3}-\d{3}-\d{4}\s<br>#m
Alas .. my results yield nothing =( I don know that the end of each line in the HTML is a LF not CR/LF. I did try using the s modifier instead of the m. Still no luck! Oh .. I'm using preg_match_all and not just preg_match
I've seen multi-lines done but it was congested with \/.*+ and other thing I couldn't follow it. If you could please help me with this one and break it down for me so I can under stand what is going on. I think once I get this one under my belt and I can follow it I can do others.
Hope you can help! I'll consider if an xmas present! =) Probably the only one I'll be getting this year! :eek:
Thanks much in advance!
<div id="directions">
<div class="item">
<div class="number">1</div> Steak 'N Shake
<div style="margin-bottom: 20px;">
3810 W. Washington<br>
Indianapolis, IN 46241 <br>
317-241-0483 <br><br>
Hours: <br>
Dining Room:
<div>Monday: Anytime</div>
<div>Tuesday: Anytime</div>
<div>Wednesday: Anytime</div>
<div>Thursday: Anytime</div>
<div>Friday: Anytime</div>
<div>Saturday: Anytime</div>
<div>Sunday: Anytime</div>
<div class="show">Drivethrough: </div>
<div class="show">Monday: </div>
<div class="show">Tuesday: </div>
<div class="show">Wednesday: </div>
<div class="show">Thursday: </div>
<div class="show">Friday: </div>
<div class="show">Saturday: </div>
<div class="show">Sunday: </div>
</div>