473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

preg_match on HTML content

69
Hi,

I have a section of HTML that I need to match.

Expand|Select|Wrap|Line Numbers
  1. <div class="padding8">
  2. <h2>Student Membership</h2>
  3. Open to anyone under 25 years of age undergoing training with
  4. the aim of becoming a Corporate Member.
  5. <h3>Annual Fee &pound;30</h3>
  6. </div>
  7.  
I cannot just search for the H2 header because in some sections it may be a H3 header. I need to return everything from the first header to the end of the div.

Thanks,

Sean
Sep 17 '07 #1
1 1048
Can you search for
Expand|Select|Wrap|Line Numbers
  1. <div class="padding8">
  2.  

? That'd probably be easiest.
Sep 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Han | last post by:
I'm wondering if someone can explain why the following works with preg_match_all, but not preg_match: $html = "product=3456789&amp;" preg_match_all ("|product=(\d{5,10})&amp;|i", $html, $out); $out...
22
by: stoppal | last post by:
need to extract all text between the following strings, but not include the strings. "<!-- #BeginEditable "Title name" -->" "<p align="center">#### </p>" I am using preg_match(????, $s,...
4
by: Yandos | last post by:
Hi all, I'd like to work with a binary file.... I read the whole file into variable (it conatains binary data from 00-FF): $fp=fopen($cfg,"r"); $content=fread($fp,filesize($cfg));...
11
by: nintesa | last post by:
Hello... I'm trying to write a regular expression to match the content of a html tag. I need to match the content of <h1i.e. <h1>Hello World</h1> <h1 class="red_background">Hello World</h1>...
5
by: jeddiki | last post by:
Hi, I am wanting to do a simple extraction of the three key header elements from a web page namely these: Is the preg_match() function the best way to find them and put them into variables...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.