473,811 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

preg_match_all issue, need some help

I'm running a script that at one point will collect <imgtags from
some html. I've been using the following:

preg_match_all( "/<img .*?>/",$html,$images );

and I thought it was working well. However, I've notice that some
things i throw at it don't work properly. It seems to be that and
image tag closing itself with "/>" doesn't work, ie <img src="..... " /
>. I'm guessing the "/" character is delimiting the regex somehow.
Admittedly I know very little about regular expressions. Anyone know
whats going on and the best way to get all the image tags? I ideally
would like the whole thing, from the <img to the final closing bracket
>.
Feb 28 '08 #1
1 1274
On Thu, 28 Feb 2008 02:30:58 +0100, dysfunct <Dy*********@gm ail.comwrote:
I'm running a script that at one point will collect <imgtags from
some html. I've been using the following:

preg_match_all( "/<img .*?>/",$html,$images );

and I thought it was working well. However, I've notice that some
things i throw at it don't work properly. It seems to be that and
image tag closing itself with "/>" doesn't work, ie <img src="..... " /
>. I'm guessing the "/" character is delimiting the regex somehow.
Admittedly I know very little about regular expressions. Anyone know
whats going on and the best way to get all the image tags? I ideally
would like the whole thing, from the <img to the final closing bracket
preg_match_all( "/<img[^>]*>/",$html,$images );

However, proper use of DOM & getElementsByTa gName() could be more easily
maintained.

--
Rik Wasmus
Feb 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2155
by: sri | last post by:
Hi, I have a datatable to store some values like name, id etc. in ASP.NET I have scenario where i need to modify more than one records of the datatable . I am trying to use dataview as below. If mdviewmodifyGroup.Count > 0 Then mdviewmodifyGroup.AllowEdit = True For pintCount = 0 To mdviewmodifyGroup.Count - 1
2
1760
by: Paul Brun | last post by:
Hello everyone, I have tried all the solutions trying to figure out how to remedy my mixed mode DLL solution, however, I still can't get the project to compile. I have tried all the solutions managed in the Microsoft Knowledgebase article, but I get the following issues: libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj) libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in...
3
1534
by: Mike | last post by:
I have a web page that displays contact people in a drop down. the users selects a person then clicks the go button. The datagrid should pop with all the information on the select contact person, correct? Well, now my issue. I have 5 contact names in the drop down, (pop from DB) when I select one nothing happens except for one name. I only get information back for only one person, nothing happens if i select a different name. The grid...
2
869
by: Will | last post by:
hey guys, if i want to know if a specific .exe (SomeExe.exe) is running on any of the computers on the network, how can i do that ? in other words, i need the find out how many computers are running someexe.exe on the network (myNetwork) NEED CODE PLEASE THANX IN ADVANCE
3
3516
by: Terry Olsen | last post by:
I have a string that is approximately 600 characters. I need to divide up the string into 400 character chunks. I'm having trouble with using LastIndexOf. The following code returns a value of 594. value=msg(i).LastIndexOf(" "c) The following code returns a value of -1 value=msg(i).LastIndexOf(" "c,1)
3
4204
by: Amy Smith | last post by:
Hello there, I am having a small problem which been challenging me for few days and need help or advice. I am trying to calculate the day-shift for employees based on the time they started and finish working, I will only have 2 shifts 1 or 2 . Shift one changes based on the location however any thing else is shift 2. The problem I am having is when someone signed in after midnight; I need to report his time under shift 2 for the...
1
1282
by: jkincaid | last post by:
I need help on a simple database, I have limited ACCESS skills. Here's my dilemma: I have 2 tables: Table one is customer issues Table two is the particular customer Table one includes: Issue id, customer, status of the issue (either unresolved or resolved), description, etc. Table two includes: customer
4
2407
by: kjsphoto | last post by:
I jsut installed a new PHP 5 server as I wanted to keep the php4 version server running until I change over all the code to work with 5. Here is the problem and for the life of me I cannot figure it out. If I create a file and put it in the root of apache 2.2 on the php 5 server with the command php_info() it displays the php information. Now if I copy a file from the php4 server into the php5 root and call
1
1776
by: sara10 | last post by:
Hi, I have a datalist.what i want to do is to show my data from database as hyperlinks, and when i click on any of that link it redirects to other page. In that directed page i am getting the link text by "querystring". Every thing is working fine but the problem is that when i put the same datalist inside a tab container the "querystring" returns Null. can any one help please how can i get the hyperlink text?? here is the code. .cs...
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.