Hi All,
Having an issue with regular expressions, never been my strong point!
The following pattern only picks up one instance per line, if more than
one instance exists all text from first {{ to last }} is included, can
anyone point out where I am going wrong?
On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd. wrote:
Hi All,
Having an issue with regular expressions, never been my strong point!
The following pattern only picks up one instance per line, if more than
one instance exists all text from first {{ to last }} is included,
Robert Cummings wrote:
On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd. wrote:
Hi All,
Having an issue with regular expressions, never been my strong point!
The following pattern only picks up one instance per line, if more than
one instance exists all text from first {{ to
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: Friday, January 16, 2009 4:31 AM
To: Phil Ewington - iModel Ltd.
Cc: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all question
On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd
-Original Message-
From: Boyd, Todd M. [mailto:tmbo...@ccis.edu]
Sent: Friday, January 16, 2009 2:13 PM
To: php-general@lists.php.net
Subject: RE: [PHP] preg_match_all question
-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com]
Sent: Friday, January
I am trying to get the text between nested html tags within arrays
produced by preg_match_all. The simple situation would be:
trtdtest/td/tr
I want to return 'test'.
Assuming $post_results has some string derived from a html page source
with lots of nested tags.
Replacing new line (seems
Do you just wish to remove all the HTML tags from a given string? If so,
the strip_tags() function should do this.
Ash
www.ashleysheridan.co.uk
---BeginMessage---
I am trying to get the text between nested html tags within arrays
produced by preg_match_all. The simple situation would be:
What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long
as the whole link is one line. It seems there should be a way to get
this to work with more than one link on a single line. The work around
I have
On Thu, 2008-05-29 at 13:07 -0500, Chris W wrote:
What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long
as the whole link is one line. It seems there should be a way to get
this to work with more
On Thu, 2008-05-29 at 14:20 -0400, Robert Cummings wrote:
On Thu, 2008-05-29 at 13:07 -0500, Chris W wrote:
What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long
as the whole link is one line. It
On Thu, May 29, 2008 at 01:07:11PM -0500, Chris W wrote:
What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long
as the whole link is one line. It seems there should be a way to get
this to work
On Thu, May 29, 2008 at 2:07 PM, Chris W [EMAIL PROTECTED] wrote:
What I want to do is find all links in an html file. I have the pattern
below. It works as long as there is only one link on a line and as long as
the whole link is one line. It seems there should be a way to get this to
work
On Thu, May 29, 2008 at 8:13 PM, Eric Butera [EMAIL PROTECTED] wrote:
Why not use DOMDocument with getElementsByTagName('href') [1]
http://us2.php.net/manual/en/domdocument.getelementsbytagname.php
Sorry there was an error in that. It felt wrong when I sent it so I
looked again. Here is a
= str_replace('',,$match);
return $match;
}
-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 11, 2007 9:41 PM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all Help
[EMAIL PROTECTED] wrote:
I have tried this many
);
return $match;
}
-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 11, 2007 9:41 PM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all Help
[EMAIL PROTECTED] wrote:
I have tried this many way and for some reason
[EMAIL PROTECTED] wrote:
...
It would help to see the input text and to know exactly what you're
trying to match.
--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
--
PHP General Mailing
I have tried this many way and for some reason
I cannot pull content between the 2 pattern options.
function pullchannel($document)
{
preg_match_all('/div class=channel [^]*(.*)div
class=channel [^]*/i',$document,$elements);
$match = implode(\r\n,$elements[0]);
$match
[EMAIL PROTECTED] wrote:
I have tried this many way and for some reason
I cannot pull content between the 2 pattern options.
function pullchannel($document)
{
preg_match_all('/div class=channel [^]*(.*)div
class=channel [^]*/i',$document,$elements);
$match =
At 11:45 PM + 8/9/07, Ólafur Waage wrote:
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)
I have a weblog system that i am creating, the trouble is that if a
user
How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
preg_match_all('/img[^]*/Ui');
Off the top of my head. This wouldn't allow for using the right angle
bracket in the img tag, but that's almost never going to happen in reailty.
--
Richard Heyes wrote:
How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
preg_match_all('/img[^]*/Ui');
Off the top of my head. This wouldn't allow for using the right angle
bracket in the img tag, but that's almost never going to happen
On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:
Richard Heyes wrote:
How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
preg_match_all('/img[^]*/Ui');
Off the top of my head. This wouldn't allow for using the right angle
img src=image.jpg
Your script doesn't catch above ;)
So don't write HTML like that.
--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
--
PHP General Mailing List (http://www.php.net/)
To
On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:
img src=image.jpg
Your script doesn't catch above ;)
So don't write HTML like that.
Depends where the HTML is coming from, it might be user input
Tijnema
--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info
--
PHP
img src=image.jpg
Your script doesn't catch above ;)
So don't write HTML like that.
Depends where the HTML is coming from, it might be user input
Ok, add \s* after the initial angle bracket.
--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base
Tijnema wrote:
On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:
Richard Heyes wrote:
How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
preg_match_all('/img[^]*/Ui');
Off the top of my head. This wouldn't allow for using the right angle
On 8/11/07, Stut [EMAIL PROTECTED] wrote:
Tijnema wrote:
On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:
Richard Heyes wrote:
How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
preg_match_all('/img[^]*/Ui');
Off the top of my
Ive already finished the code and pasted it to this mailing list :)
Just an fyi.
Ólafur Waage
2007/8/11, Tijnema [EMAIL PROTECTED]:
On 8/11/07, Stut [EMAIL PROTECTED] wrote:
Tijnema wrote:
On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:
Richard Heyes wrote:
How can i match
-Original Message-
From: brian [mailto:[EMAIL PROTECTED]
Sent: Friday, August 10, 2007 3:18 AM
To: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all to match img tags
Ólafur Waage wrote:
I know this isn't exactly a php related question but due to the
quality of answers ive
On Thu, August 9, 2007 6:45 pm, Ólafur Waage wrote:
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)
I have a weblog system that i am creating, the trouble is that
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)
I have a weblog system that i am creating, the trouble is that if a
user links to an external image larger than
Ólafur Waage wrote:
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)
I have a weblog system that i am creating, the trouble is that if a
user links to an external
@lists.php.net
Subject: Re: [PHP] preg_match_all to match img tags
Ólafur Waage wrote:
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)
I have a weblog system that i am
Kristen G. Thorson wrote:
I am a regex retard.
good for you ;-)
why not take the easy route and simply strip out all HTML comments
(and whatever maybe inside them) from the string(s) before you do the
search for the 'bbcode'?
I am trying to pull keywords out of this crazy bbcode-like file,
I am a regex retard.
I am trying to pull keywords out of this crazy bbcode-like file, but
only for bbcode-like code NOT enclosed in HTML comments. I currently
have managed to create this regex:
'/(?!!--)\[!(\w+)::.*!\](?!--)/U'
Which matches
[!keyword::crazy bbcode!]
and not
Hello,
I am using the following to do link replacing:
preg_match_all(/\s*a\s+[^]*href\s*=\s*[\']?([^\' ]+)[\'
]/isU,$file[$x],$matches);
It works great for all but 'https' links. I am not that versed in
regular expressions. Would anyone know what I need to put in there so
that it will
Hi,
Below is my code for a templating kind of script, it basically searches for
'tags' like this {movies 30} and replaces them, the problem is that if there
are 2 tags (eg: {movies 30}{movies 60}) it only replaces the first one...so
I tried using a preg_match_all...
I tried using a preg_match_all
From: Ryan A [EMAIL PROTECTED]
Below is my code for a templating kind of script, it basically searches for
'tags' like this {movies 30} and replaces them, the problem is that if there
are 2 tags (eg: {movies 30}{movies 60}) it only replaces the first one...so
I tried using a
From: Ryan A [EMAIL PROTECTED]
$content = str_replace($matches[$index][0],$value,$content);
If you are interested in seeing the whole script, just scroll down.
I'm not... but thanks. Did you read what I wrote? using preg_match twice and then
str_replace is a waste. Learn to use
Hello,
I want to be sure, that preg_replace replaces all matches. But it
doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
like there is an preg_match_all. Will preg_replace replace everything by
default?
Regards
Marten
--
PHP General Mailing List (http://www.php.net/)
To
I want to be sure, that preg_replace replaces all matches. But it
doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
like there is an preg_match_all. Will preg_replace replace everything by
default?
from php.net:
mixed preg_replace ( mixed pattern, mixed replacement,
On Tue, 10 Aug 2004 18:51:43 +0200, Marten Lehmann [EMAIL PROTECTED] wrote:
Hello,
I want to be sure, that preg_replace replaces all matches. But it
doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
like there is an preg_match_all. Will preg_replace replace everything
Can anyone see why I'm getting this error message:
Warning: No ending delimiter '^' found in
C:\Inetpub\wwwMIS_DEV\import_mvs.inc.php on line 126
From this line:
if(preg_match_all(^([00])?.*$,$called,$found))
{
substring($called,2,9);
}
I basically have a phone
Jeff McKeon wrote:
Can anyone see why I'm getting this error message:
Warning: No ending delimiter '^' found in
C:\Inetpub\wwwMIS_DEV\import_mvs.inc.php on line 126
From this line:
if(preg_match_all(^([00])?.*$,$called,$found))
{
substring($called,2,9);
}
I
From: Jeff McKeon [EMAIL PROTECTED]
Can anyone see why I'm getting this error message:
Warning: No ending delimiter '^' found in
C:\Inetpub\wwwMIS_DEV\import_mvs.inc.php on line 126
From this line:
if(preg_match_all(^([00])?.*$,$called,$found))
Because you do not have an ending
From: John W. Holmes [EMAIL PROTECTED]
From: Jeff McKeon [EMAIL PROTECTED]
Can anyone see why I'm getting this error message:
Warning: No ending delimiter '^' found in
C:\Inetpub\wwwMIS_DEV\import_mvs.inc.php on line 126
From this line:
John W. Holmes wrote:
damn... i left out the ending delimiter, too.. :)
Chalk one up to Monday. ;)
--
***
* _ __ __ __ _ * John Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___ __ ___ _
[newbie, please help]
I'm trying to extract all URLs mentionning sound files from blocks of texts.
I first tried with ereg and the following code works fine :
$texte='TEST FINDbr\net voici un fichier son
http://serveur/repertoire/fichier.gig ou
ftp://serveur/repertoire/fichier.snd et
Hi,
Saturday, January 24, 2004, 1:00:10 AM, you wrote:
JJM [newbie, please help]
JJM I'm trying to extract all URLs mentionning sound files from blocks of texts.
JJM I first tried with ereg and the following code works fine :
JJM $texte='TEST FINDbr\net voici un fichier son
JJM
hi,
I have this piece of code. but the problem is that he also links parts of
words (like: credits) and i wnat only standalone words (like: edit)
Does someone have i idea to correct this piece of code?
Floris
* Thus wrote Floris ([EMAIL PROTECTED]):
hi,
I have this piece of code. but the problem is that he also links parts of
words (like: credits) and i wnat only standalone words (like: edit)
Does someone have i idea to correct this piece of code?
Floris
{
$regex1 = [^]*(;
$regex2 = )[^]*;
How do I create a preg_match for something like this?
TD CLASS=time ALIGN=CENTER VALIGN=MIDDLE!-- insert time -- B7
PM/B/TD
TD BGCOLOR=#BFD8F6IMG SRC=spacer.gif WIDTH=1 HEIGHT=1
BORDER=0 ALT=/TD
I want to store the individual times in an array and then loop through them
if that
I am having problems with preg_match_all spanning over newlines.
Using /m does not seem to ignore the the newlines.
// This works
// Both contents inside td and /td are found
$html = 'tr valign=top
td width=10One cell/td
tdAnother/td
/tr';
// This does not
// Only the contents inside the first
Hi,
Thursday, April 3, 2003, 11:33:02 PM, you wrote:
TJ I am having problems with preg_match_all spanning over newlines.
TJ Using /m does not seem to ignore the the newlines.
TJ // This works
TJ // Both contents inside td and /td are found
TJ $html = 'tr valign=top
TJ td width=10One cell/td
TJ
He needs both. /s makes dot to include new lines too, so you're right.
Niklas
-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]
Sent: 3. huhtikuuta 2003 16:26
To: Thomas Johnsson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] preg_match_all()
Hi,
Thursday, April 3, 2003, 11
I am having to edit a php script that one of our previous employees had
written and I am having a problem understanding the preg_match_all function.
preg_match_all(|img src=/news/(.*)|U, $read, $result2);
here is what I THINK I know: The | at the beginning signifies the start of
the text to
It's in the manual:
/U/ (PCRE_UNGREEDY)
This modifier inverts the greediness of the quantifiers so that
they are not greedy by default, but become greedy if followed by
?. It is not compatible with Perl. It can also be set by a (?U)
modifier setting within the pattern.
Jay
As described in http://www.php.net/manual/en/function.preg-match-all.php, I
have put in place a bit of code theoretically designed to parse out snippets
of text embraced with an open and close tag. The code I am using is this:
]
Sent: Monday, March 03, 2003 7:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP] preg_match_all()
As described in
http://www.php.net/manual/en/function.preg-match-all.php,
I
have put in place a bit of code theoretically designed to parse out
snippets
of text embraced with an open and close tag
On Mon, 3 Mar 2003 19:51:09 -0500, you wrote:
preg_match_all('/begincommand(.*)endcommand/',$messagebody,$commandOuttake,P
REG_PATTERN_ORDER);
[...]
How
do I change the criteria to stop at the first instance of a match? How do I
parse out only up to the first instance of endcommand?
Here's an
hi,
i try to parse html data with php's preg_match_all() function.
here is a sample data that i try to parse:
a href=http://www.xxx.com; class=Mxxx/a
the regular expression that i use is:
preg_match_all(/a[ ]href=\([^\]+)\[ ]class=M([^]+)\/a/,$buffer,$ma
tch);
by this expression i get the
I have some experience in using regular expressions in Perl, and have been
able to use preg_match in php, but am having a problem with preg_match_all.
I'm trying to extract data from an HTML table. Here's my preg_match call
that correctly grabs the 1st row of data in the table. It grabs 4 columns
Hi Randall,
If you look closely at the definition of preg_match_all(), you'll see
that it generates an array of arrays--that's because, for each match, it
generates an array that corresponds to the result of a single call to
preg_match, then puts all the resulting array into another array.
If
That was my understanding. Question is, why don't my print commands
work...or...how do you access 2 dimensional arrays in php?
Hi Randall,
If you look closely at the definition of preg_match_all(), you'll see
that it generates an array of arrays--that's because, for each match, it
generates
On Monday 18 November 2002 01:09, Randall Perry wrote:
That was my understanding. Question is, why don't my print commands
work...or...how do you access 2 dimensional arrays in php?
print_r() or var_dump()
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems
Hi, I'm a frog (french),
I,ve some troubles with the preg_match_all function.
input type=TEXT name=search maxlength=50 size=36
$strSearchWords = Trim($search);
$pattern = $strSearchWords;
andwhile (!feof($openFile))
{
Hi, I'm a frog (french),
I,ve some troubles with the preg_match_all function.
input type=TEXT name=search maxlength=50 size=36
$strSearchWords = Trim($search);
$pattern = $strSearchWords;
andwhile (!feof($openFile))
{
Hi All,
I have being working on PHP perl compaitable regular expressions for the last
month and cannot work out how to program a preg_match_all that will get the
file.html from the following examples:
a href=file.html
a href='file.html'
a href=file.html
frame src=file.html
frame
PHPGalaxy.com wrote:
...
A link from one such entry looks like this:
psPhoneEntry.py?firstname=Adamlastname=Collierstreet=3912+Foley+Glen+Circity=Fentonstate=MIzip=48430-3435phone=8107507456
My matching pattern looks like this:
$engreg =
On Tuesday 23 October 2001 02:47, PHPGalaxy.com wrote:
My matching pattern looks like this:
$engreg =
'/psPhoneEntry.py?firstname=(.*?)lastname=(.*?)street=(.*?)city=(.*?
)state=(.*?)zip=(.*?)phone=(.*?)\/i';
Note the / at the beginning, and /i at the end. those have always
been there in
I've never had good luck with this function. I first learned how to
(sorta) use it from looking at other code. It worked fine when I made a
meta search engine, but when I tried on expanding on it, well, I've
started losing hair. =) Here's the scenario:
I'm trying to parse results from Yahoo's
71 matches
Mail list logo