On Fri, Mar 27, 2009 at 9:40 AM, Shawn McKenzie nos...@mckenzies.net wrote:
I'm normally OK with regex, especially if I fiddle with it long enough,
however I have fiddled with this one so long that I'm either totally
missing it or it's something simple. Does it have anything to do with
the
haliphax wrote:
On Fri, Mar 27, 2009 at 9:40 AM, Shawn McKenzie nos...@mckenzies.net wrote:
I'm normally OK with regex, especially if I fiddle with it long enough,
however I have fiddled with this one so long that I'm either totally
missing it or it's something simple. Does it have anything
-Original Message-
From: Jason Pruim [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2008 7:30 AM
To: PHP-General List
Subject: [PHP] Regex help
Hey everyone,
Not completely specific to php but I know you guys know regex's
better then I do! :)
I am attempting to match
On May 16, 2006, at 7:53 PM, Chrome wrote:
-Original Message-
From: Robert Samuel White [mailto:[EMAIL PROTECTED]
Sent: 17 May 2006 01:42
To: php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's [ANSWER]
That's what I was doing. I was parsing A:HREF, IMG:SRC, etc
This one time, at band camp, Robert Samuel White [EMAIL PROTECTED] wrote:
Don't be rude. I've already don't all of that. Nothing came up. I've been
programming for 20 years (since I was 11 years old) so I'm not a slacker
when it comes to learning new things, however, I have always found
Robert Samuel White wrote:
Can someone help me modify the following code?
It was designed to search for all instances of [LEVEL#]...[/LEVEL#]
I need a preg_match_all that will search for all of instances of an URL.
It should be sophisticated enough to find something as complicated as this:
: [PHP] Regex Help for URL's
Robert Samuel White wrote:
Can someone help me modify the following code?
It was designed to search for all instances of [LEVEL#]...[/LEVEL#]
I need a preg_match_all that will search for all of instances of an URL.
It should be sophisticated enough to find
On Tue, 2006-05-16 at 16:31, Robert Samuel White wrote:
Don't be rude. I've already don't all of that. Nothing came up. I've been
programming for 20 years (since I was 11 years old) so I'm not a slacker
when it comes to learning new things, however, I have always found regular
expressions
it makes the email hard to read.
Why is top posting bad?
-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 16, 2006 4:28 PM
To: Robert Samuel White
Cc: php-general@lists.php.net
Subject: Re: [PHP] Regex Help for URL's
Robert Samuel White wrote:
Can
I am trying to get all of the urls in a web document, so that I can append
information to the urls when needed (when the url points to a domain that
resides on my server). It allows me to pass session information across the
domains of my network. Currently, I use a class I wrote to handle this,
: Re: [PHP] Regex Help for URL's
Robert Samuel White wrote:
Can someone help me modify the following code?
It was designed to search for all instances of [LEVEL#]...[/LEVEL#]
I need a preg_match_all that will search for all of instances of an URL.
It should be sophisticated enough to find
-Original Message-
From: Robert Samuel White [mailto:[EMAIL PROTECTED]
Sent: 16 May 2006 21:32
To: php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's
Don't be rude. I've already don't all of that. Nothing came up. I've
been
programming for 20 years (since I
In case any one is looking for a solution to a similar problem as me, here
is the answer. I used the code from my original post as my guiding light,
and with some experimentation, I figured it out.
To get any URL, regardless of where it is located, use this:
preg_match_all(#\'http://(.*)\'#U,
On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote:
In case any one is looking for a solution to a similar problem as me, here
is the answer. I used the code from my original post as my guiding light,
and with some experimentation, I figured it out.
To get any URL, regardless of where
On Tue, May 16, 2006 6:21 pm, Robert Cummings wrote:
On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote:
In case any one is looking for a solution to a similar problem as
me, here
preg_match_all(#(\|')http://(.*)(\|')#U, $content, $matches);
And it's missing the original requirement of
All pages used by my content management system must be in a valid format.
Old-school style pages are never created so the solution I have come up with
is perfect for my needs.
Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-Original Message-
From: Robert Samuel White [mailto:[EMAIL PROTECTED]
Sent: 17 May 2006 01:16
To: php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's [ANSWER]
All pages used by my content management system must be in a valid format.
Old-school style pages
On Tue, May 16, 2006 4:22 pm, Jochem Maas wrote:
personally I would assume anyone who had been programming for 20 yrs
would have a reasonable understanding of regexps.
Nope.
:-)
I got WAY past 20 year mark before I even began to pretend to
understand the minimal amount of regex I can do now.
, then they'll code their pages to make use of this limitation.
-Original Message-
From: Chrome [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 16, 2006 8:24 PM
To: 'Robert Samuel White'; php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's [ANSWER]
-Original Message
-Original Message-
From: Robert Samuel White [mailto:[EMAIL PROTECTED]
Sent: 17 May 2006 01:28
To: php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's [ANSWER]
In my opinion, it is the most reasonable solution. I have looked all over
the web for something else
If we are talking clickable links, why not focus on the a construct
itself? Otherwise URLs are just part of the page's textual content... Very
difficult to parse that
Disseminating an a tag isn't brain-meltingly difficult with a regex if
you put your mind to it... With or without quotes, be
-Original Message-
From: Robert Samuel White [mailto:[EMAIL PROTECTED]
Sent: 17 May 2006 01:42
To: php-general@lists.php.net
Subject: RE: [PHP] Regex Help for URL's [ANSWER]
If we are talking clickable links, why not focus on the a construct
itself? Otherwise URLs are just
On Fri, Jan 13, 2006 at 08:25:57AM -0500, Mike Smith wrote:
I'm trying to save myself some time by extracting certain variables
from a string:
102-90 E 42 X 42 X 70 3/8
I've been testing with: http://www.quanetic.com/regex.php
and have been somewhat successful. Using this pattern:
Mike Smith wrote:
I'm trying to save myself some time by extracting certain variables
from a string:
102-90 E 42 X 42 X 70 3/8
If this string is always in this format
xxx E panel X width X height
then you could try something like:
// Very much untested
$unit = '102-90 E 42 X 42 X 70 3/8';
This should do the trick:
/(\d+) ?X ?(\d+) ?X ?(\d+ [\d\/]+)/i
(at least it would in Perl)
Le 13 Janvier 2006 08:25, Mike Smith a écrit :
I'm trying to save myself some time by extracting certain variables
from a string:
102-90 E 42 X 42 X 70 3/8
I've been testing with:
Eric, thanks for replying. I couldn't quite get that to work. Albert,
I'm currently working with what you suggested, though the unit names
are not that consistent:
$vals = preg_split(' ?X? ',$unit[1]);
echo strong.$unit[1]./strongbr /\n;
echo Panel: .$vals[0].br /Width: .$vals[1].br /Height:
On Fri, 2005-11-18 at 10:55, Chris Boget wrote:
Why isn't this regular expression
^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$
allowing for this value:
'Co. Dublin' (w/o the single quotes)
? It's failing the regular expression match...
Do you have that expression embedded in single or double
Chris,
if (preg_match(/^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$/, Co. Dublin))
echo TRUE;
else
echo FALSE;
prints TRUE for me.
Cheers,
David Grant
Chris Boget wrote:
Why isn't this regular expression
^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$
allowing for this value:
'Co. Dublin' (w/o the
Hi, folks. I'm having trouble with a simple regex. I'm sure it's just
something small that I'm missing but nothing I'm trying is working.
In an HTML file I have comments like this:
!-- START PRINT --
various html crap here
!-- END PRINT --
Here's the regex I'm using:
/!-- START PRINT
Hi, folks. I'm having trouble with a simple regex. I'm sure it's just
something small that I'm missing but nothing I'm trying is working.
In an HTML file I have comments like this:
!-- START PRINT --
various html crap here
!-- END PRINT --
Here's the regex I'm using:
/!-- START
Greetings folks. Thanks Murray and Philip for the quick responses.
Adding the /s modifier worked perfectly.
Cheers,
Pablo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Shaun wrote:
Hi,
I am trying to implement a regular expression so that I have a number
between 0.00 and 1.00. the following works except I can go up to 1.99
$regexp = /^[0-1]{1}.[0-9]{2}/;
Can anyone help here please?
Thanks
May have to go outside just a regex...
if ( preg_match (
On Mon, 2005-09-19 at 10:11, John Nichel wrote:
Shaun wrote:
Hi,
I am trying to implement a regular expression so that I have a number
between 0.00 and 1.00. the following works except I can go up to 1.99
$regexp = /^[0-1]{1}.[0-9]{2}/;
Can anyone help here please?
Thanks
On Monday 19 September 2005 09:03 am, Shaun wrote:
Hi,
I am trying to implement a regular expression so that I have a number
between 0.00 and 1.00. the following works except I can go up to 1.99
$regexp = /^[0-1]{1}.[0-9]{2}/;
Can anyone help here please?
Thanks
$regexp =
On 8/4/05, Lizet Pena de Sola [EMAIL PROTECTED] wrote:
Ok, it's not the regexp for detecting email addresses what I need,
that's widely published, thanks. I'm using ereg to match this regular
expression:
(On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:)
That will match phrases like
On 8/3/05, Carol
: Marcus Bointon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 03, 2005 8:57 AM
To: PHP General
Subject: Re: [PHP] Regex help
On 2 Aug 2005, at 15:12, Robin Vickery wrote:
I don't suppose this is the place for a rant about the futility of
checking email addresses with a regexp?
Though I
On 2 Aug 2005, at 15:12, Robin Vickery wrote:
I don't suppose this is the place for a rant about the futility of
checking email addresses with a regexp?
Though I will agree with you to some extent, I've had quite a lot of
success with this, which is pretty thorough:
On 8/2/05, Chris Boget [EMAIL PROTECTED] wrote:
I'm trying to validate an email address and for the life of me I
cannot figure out why the following regex is not working:
$email = [EMAIL PROTECTED];
$regex =
On 8/2/05, Robin Vickery [EMAIL PROTECTED] wrote:
I don't suppose this is the place for a rant about the futility of
checking email addresses with a regexp?
-robin
Let Richard Lynch tell him. He's good at regex's, and it's HIS email
address that never makes it through!
Dotan Cohen
I am currently creating a once off text parser for a rather large
document that i need to strip out bits of information on certain
lines.
The line looks something like :
Adress line here, postcode, country Tel: +27 112233665 Fax: 221145221
Website: http://www.urlhere.com E-Mail: [EMAIL
On Thu, 14 Apr 2005, Bosky, Dave wrote:
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if ( ereg([A-Z0-9], $field)
Philip Hallstrom wrote:
On Thu, 14 Apr 2005, Bosky, Dave wrote:
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if (
Hi,
Thursday, April 14, 2005, 11:47:13 PM, you wrote:
BD I wanted to create a regex that force a PHP form text field to meet the
BD following requirements:
BD a. Must contain an 1 uppercase letter. [A-Z]
BD b. Must contain 1 digit. [0-9]
BD c. Must be a minimum of 7 characters in length. {7}
I wanted to create a regex that force a PHP form text field to meet the
following requirements:
a. Must contain an 1 uppercase letter. [A-Z]
b. Must contain 1 digit. [0-9]
c. Must be a minimum of 7 characters in length. {7}
if ( ereg([A-Z0-9], $field) strlen($field) = 7 ) {
print(We have a
On 15 Apr 2005 Tom Rogers wrote:
BD a. Must contain an 1 uppercase letter. [A-Z]
BD b. Must contain 1 digit. [0-9]
BD c. Must be a minimum of 7 characters in length. {7}
BD I'm not sure of how to build the correct syntax for using all 3
BD requirements together.
easier done seperately I
[EMAIL PROTECTED] wrote:
OK, this is off-topic like every other regex help post, but I know
some of you enjoy these puzzles :)
This isn't an exam question, is it? ;)
I need a validation regex that will pass a string. The string can
be no longer than some maximum length, and it can contain
On Sat, 2005-01-29 at 08:58, Michael Sims wrote:
[EMAIL PROTECTED] wrote:
OK, this is off-topic like every other regex help post, but I know
some of you enjoy these puzzles :)
This isn't an exam question, is it? ;)
I need a validation regex that will pass a string. The string can
be
Bret Hughes wrote:
On Sat, 2005-01-29 at 08:58, Michael Sims wrote:
[EMAIL PROTECTED] wrote:
I need a validation regex that will pass a string. The string can
be no longer than some maximum length, and it can contain any
characters except two consecutive ampersands () anywhere in the
string.
Michael Sims wrote:
I need a validation regex that will pass a string. The string can
be no longer than some maximum length, and it can contain any
characters except two consecutive ampersands () anywhere in the
string.
Yup, use this perl regex:
/^(?:()(?!)|[^]){1,5}$/
[snip]
Hope
On 28 Jan 2005 [EMAIL PROTECTED] wrote:
I need a validation regex that will pass a string. The string can be no
longer than some maximum length, and it can contain any characters except
two consecutive ampersands () anywhere in the string.
This is an example of something that is easier to
[EMAIL PROTECTED] wrote on 01/28/2005 03:19:14 PM:
On 28 Jan 2005 [EMAIL PROTECTED] wrote:
I need a validation regex that will pass a string. The string can be
no
longer than some maximum length, and it can contain any characters
except
two consecutive ampersands () anywhere in the
[EMAIL PROTECTED] wrote:
OK, this is off-topic like every other regex help post, but I know some
of you enjoy these puzzles :)
I need a validation regex that will pass a string. The string can be no
longer than some maximum length, and it can contain any characters except
two consecutive
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote on 01/28/2005 03:19:14 PM:
On 28 Jan 2005 [EMAIL PROTECTED] wrote:
I need a validation regex that will pass a string. The string can be
no
longer than some maximum length, and it can contain any characters
except
two consecutive
On 28 Jan 2005 [EMAIL PROTECTED] wrote:
Thanks, Tom. I agree, but not an option at this time - other parts of the
design require this to be a regex.
It is pretty easy to do with two regexps, one to check the length and
another to see if there is a double . Would that work? I don't know
[EMAIL PROTECTED] wrote on 01/28/2005 04:13:38 PM:
On 28 Jan 2005 [EMAIL PROTECTED] wrote:
Thanks, Tom. I agree, but not an option at this time - other parts of
the
design require this to be a regex.
It is pretty easy to do with two regexps, one to check the length and
another to
Mike Ford wrote:
Just off the top of my head (and untested!), I'd try something like
/b(\s+[^]*)?/
Cheers!
Mike
That pretty much seems to work the best. Thanks all!
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List
On Thu, 13 Jan 2005 16:06:32 -0500, Jason Morehouse [EMAIL PROTECTED] wrote:
Hello,
I normally can take a bit of regex fun, but not this time.
Simple enough, in theory... I need to match (count) all of the bold tags
in a string, including ones with embedded styles (or whatever else can
go
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
-Original Message-
From: Jason Morehouse
Sent: 13/01/05 21:06
I normally can take a bit of regex fun, but not this time.
Simple enough, in theory... I need to match
Do you have the example regex so far?
I'd suggest maybe b[^r] might just do what you want
-Original Message-
From: Jason Morehouse [mailto:[EMAIL PROTECTED]
Sent: 13 January 2005 21:07
To: php-general@lists.php.net
Subject: [PHP] regex help
Hello,
I normally can take a bit of regex
On Friday 14 January 2005 05:06, Jason Morehouse wrote:
Simple enough, in theory... I need to match (count) all of the bold tags
in a string, including ones with embedded styles (or whatever else can
go in there). b and b style=color:red. My attempts keep matching
br as well.
Jason Morehouse wrote:
Simple enough, in theory... I need to match (count) all of the bold tags
in a string, including ones with embedded styles (or whatever else can
go in there). b and b style=color:red. My attempts keep matching
br as well.
I think something not unlike:
'/b( .*|)/'
The
On Thu, 2005-01-13 at 15:06, Jason Morehouse wrote:
Hello,
I normally can take a bit of regex fun, but not this time.
Simple enough, in theory... I need to match (count) all of the bold tags
in a string, including ones with embedded styles (or whatever else can
go in there). b and b
Jason Morehouse wrote:
Hello,
I normally can take a bit of regex fun, but not this time.
Simple enough, in theory... I need to match (count) all of the bold tags
in a string, including ones with embedded styles (or whatever else can
go in there). b and b style=color:red. My attempts keep
Can you post a little sample of the data and your current code?
thanks.
Jim Grill
Web-1 Hosting
http://www.web-1hosting.net
- Original Message -
From: Kathleen Ballard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 01, 2004 8:27 AM
Subject: [PHP] regex help
I am at the
On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard
[EMAIL PROTECTED] wrote:
I am at the tailend of a project that involves moving
legacy data from one dbms to another. The client has
added a new requirement to the data manipulation that
is required. I need to remove all br / tags
Forget my first attempt, using the e modifier and another preg_replace
is much better.
$return = preg_replace('!h(\d)(.*?)/h\1!ie',
'preg_replace(!br[^]*!i, , $1)', $originalText);
On Sun, 1 Aug 2004 13:39:49 -0700, Justin Patrin [EMAIL PROTECTED] wrote:
On Sun, 1 Aug 2004 06:27:51 -0700 (PDT),
On Sun, 1 Aug 2004 10:38:06 -0700 (PDT)
Kathleen Ballard [EMAIL PROTECTED] wrote:
Sorry,
Here is the code I am using to match the h* tags:
h([1-9]){1}.*/h([1-9]){1}
I have removed all the NL and CR chars from the string
I am matching to make things easier. Also, I have run
tidy on the
* Thus wrote hitek ([EMAIL PROTECTED]):
Greetings list,
I have been given a list of products, and I need some help building a
regular expression to split the category from the sub category.
Example:
CamerasDigital_CannonXLRshot -Original entry in list
Cameras Digital Cannon XLRshot
Curt,
That's perfect. Works like a charm.
Thanks,
Keith
At 03:54 PM 5/10/2004, Curt Zirzow wrote:
* Thus wrote hitek ([EMAIL PROTECTED]):
Greetings list,
I have been given a list of products, and I need some help building a
regular expression to split the category from the sub category.
Sorry I to should have added this this is what im going with so far
preg_match(/\d100.*/);
This will match a digit, followed by '100', followed by anything.
Go with Rob's suggestion.
-
michal migurski- contact info and pgp key:
Hello Brent,
Tuesday, March 16, 2004, 12:39:27 PM, you wrote:
BC im in desperate need of help for a reg expression to ONLY allow 8
BC NUMBERS to start with 100 and may not have any other kind of
BC letters or characters. Only numbers
BC for example
BC 10064893
It's not a reg exp, but it will
On Tue, Mar 16, 2004 at 02:39:27PM +0200, Brent Clark wrote:
Hi there
im in desperate need of help for a reg expression to ONLY allow 8 NUMBERS to start
with 100 and may not have any other kind of
letters or characters. Only numbers
for example
10064893
if
On 03/16/2004 6:57 AM, Rob Ellis [EMAIL PROTECTED] wrote:
On Tue, Mar 16, 2004 at 02:39:27PM +0200, Brent Clark wrote:
Hi there
im in desperate need of help for a reg expression to ONLY allow 8 NUMBERS to
start with 100 and may not have any other kind of
letters or characters. Only
Ryan A mailto:[EMAIL PROTECTED]
on Monday, March 15, 2004 9:07 AM said:
I know this is pretty easy to do but I am horrorable at working with
regular expressions and was wondering if anybody might take a min to
help please.
in that case you should get the regex coach (easy to find via
On Tuesday 16 March 2004 01:06, Ryan A wrote:
I know this is pretty easy to do but I am horrorable at working with
regular expressions and was wondering if anybody might take a min to help
please.
I will have a variable: $the_extention
which will have a value like:
I will have a variable: $the_extention which will have a value like:
98797-234234--2c-something-2c
How do I take out the part which will always start with --2c and will
always end with -2c
You could use preg_replaces, like so:
$result = preg_replace('/--2c.+-c/', '', $the_extention);
At 6:06 PM +0100 3/15/04, Ryan A wrote:
I know this is pretty easy to do but I am horrorable at working with regular
expressions and was wondering if anybody might take a min to help please.
I will have a variable: $the_extention
which will have a value like:98797-234234--2c-something-2c
How
Hey,
Thanks guys.
I did search on google first for a tutorial, problem is with something as
widely used as regular expressions
there are LOTS of results...I felt it would be better to ask if anyone has a
favourite..
ie:
if you learnt it off the web and not via the manual.
The last time I had
On 15 Mar 2004 Eric Gorr wrote:
which will have a value like:98797-234234--2c-something-2c
How do I take out the part which will always start with --2c and will
always end with -2c
I'd be interested in the answer to this question as well.
Seems like it should be easy.
It is easy.
Hey Guys,
Solved this, took your advise and avoided regex as its an overkill.
Case you're interested:
$th_var=98797-234234--2c-something-2c;
$piece = explode(--2, $th_var);
echo $piece[0];
(and if i want to use the second part... $piece[1] )
Thanks to everyone who gave me examples, links and
Thanks to everyone who gave me examples, links and suggested alternatives
like explode(), but personally I thought explode too was a regex..:-(.
explode() is not, split() is.
-
michal migurski- contact info and pgp key:
sf/ca
Untested:
function fixhisnumber($str){
//remove all but numbers
$str = preg_replace(/[^0-9]/,,$str);
//append 1, unless it's already there
$str = $str[0] == '1'? $str:1.$str;
if (strlen($str) == 10) return $str;
else return -1;
}
Mohamed~
On Fri, 2003-10-10 at 14:01, Lists wrote:
I do not
Firstly,
If your text spans more than one line you should use
\n, rather than just doing something like :
a href=\
hello\...(.*)/a
because that will mess up, depending on what text
editor you use, eg. notepad will put \r\n, but it
should only be \n. Though I'm not sure about it.
So the best
Hello,
This is a reply to an e-mail that you wrote on Mon, 21 Jul 2003 at
08:59, lines prefixed by '' were originally written by you.
Can't seem to get this to work...
trying to yank stuff xxx from
TD class=a8b noWrap align=middle width=17
bgColor=#ccxxx/td
Try this:
Sid [EMAIL PROTECTED] wrote:
Hello,
Well I am doing by first reg ex operations and I am having problems which I just
cannot figure out.
For example I tried
echo eregi_replace (tr bgcolor=\#F8F8F1\(\s*)td\s*font
size=\2\\s*purchasing power parity, '%POWER%', 'tdtrsdsdsstr
At 07:47 11.02.2003, Lord Loh. said:
[snip]
I am new to regex and broke my head on it the other day...in vain...
Can any one tell me a place to get a step by step tutorial on it or help me
out on how to work it out ?
This one time, at band camp,
Lord Loh. [EMAIL PROTECTED] wrote:
I am trying to make a link collector.
after opening the desired page, I want to get all the hyperlinks on it...
OK, this is quick and nasty, but you can add sanity/error checking etc
as you please, but it shows you the concept..
addslashes()
- Original Message -
From: Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 11:26 AM
Subject: [PHP] Regex Help
Could someone show me how to use preg_replace to change this:
test OPTION VALUE=testtest/OPTION test
into:
anotherword OPTION
is to change 'test' into 'anotherword'
only if it is not within the option tag.
Thanks!
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: Jim [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 12:42 PM
Subject: Re: [PHP] Regex Help
addslashes
, December 19, 2002 11:55 AM
Subject: Re: [PHP] Regex Help
I'm sorry, I accidentally left the slashes on my second example. My original
message should read:
Could someone show me how to use preg_replace to change this:
test OPTION VALUE=testtest/OPTION test
into:
anotherword OPTION VALUE
Subject: Re: [PHP] Regex Help
?php
$q = test OPTION VALUE=\test\test/OPTION test;
ereg((.*)(OPTION.*OPTION)(.*),$q,$ar);
$t = anotherword.$ar[2].anotherword;
print $t;
?
outputs:
anotherwordOPTION VALUE=testtest/OPTIONanotherword
--
PHP General Mailing List (http://www.php.net
]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 1:24 PM
Subject: Re: [PHP] Regex Help
Thanks for helping. Unfortunately, that doesn't quite accomplish the task
either. The other example for my first post would be mangled with that.
- Original Message -
From: Rick Emery [EMAIL
OPTION VALUE=testtest/OPTION anotherword
- Original Message -
From: Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 12:25 PM
Subject: Re: [PHP] Regex Help
Whoops, sorry post aborted prematurely.
What I was going say say was that:
test, something OPTION VALUE
. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
-Original Message-
From: Jim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 1:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Regex Help
Thanks
Instead of splitting the string on chars that don't equal \w and ',
split it on chars that equal \s (or any other you need)
Gerard Samuel wrote:
Im trying to explode a string into an array of words using -
$title = preg_split('/[^\w\']/', $title, -1, PREG_SPLIT_NO_EMPTY );
It seems to work
I use this, but it's a preg rather than ereg pattern:
'/([a-z0-9]+[a-z0-9\-]*\.)+[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$/i'
Two problems (which in practice are so slight that I've foregone my usual
standards-analness to ignore them)
1) It will allow a domain name component (except the final one)
I think he means swap...
--
Lasse
Jack Dempsey [EMAIL PROTECTED] wrote in message
000601c10e81$03aca260$22ebd73f@2pqjp01">news:000601c10e81$03aca260$22ebd73f@2pqjp01...
What exactly are you trying to do? Switch around in what way?
Jack
-Original Message-
From: Alvin Tan
What exactly are you trying to do? Switch around in what way?
Jack
-Original Message-
From: Alvin Tan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 12:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex help
hi all,
a little OT here, but need some quick help. I have a bunch of
Sheridan,
I didn't test this in PHP, I'm more familiar with the Perl Regex, but this
might work for you, play with it:
/img\s*src=([^ ]*)/
note: \s = whitespace and the [^ ] means any nonspace character... the only
issue remaining that you might find s or 's around the string matched into
the
On Friday 30 March 2001 06:47, you wrote:
Ok, i have a text file with lines that looks like this:
14```value```value2`value3
This would be fine, except...there are sometimes more than in
other columns, so id like it to be
14``value``value2``value3
$new = preg_replace ('/`+/',
1 - 100 of 110 matches
Mail list logo