hi...
trying to figure out the best approach to using preg_match to extract the
number from the follwing type of line...
131646 sometext follows..
basically, i want to extract the number, without the text, but i have to be
able to match on the text
i've been playing with different preg_match
preg_match('/^([0-9]+) (.)+/',$sString,$aMatches);
Matches will be 1 = the number ; 2 = the text. The expression only matches
if there is any character after the space. Not necessarily text, it might
be another number or special characters
2009/2/6 bruce bedoug...@earthlink.net
hi...
trying
bruce wrote:
hi...
trying to figure out the best approach to using preg_match to extract the
number from the follwing type of line...
131646 sometext follows..
basically, i want to extract the number, without the text, but i have to be
able to match on the text
i've been playing
Hello,
How do I find an exact match of a string with preg_match?
Example:
String1: www.test.com/
String2: www.test.com/somepage.php?param1=true
How do you write the regexp to only return String1 and not String2 when you
match against www.test.com ??
Thanks in advance.
Nicke
--
PHP General
Try using a pattern set to the following:
$pattern = /^www.test.com$/;
and refer to: http://uk.php.net/manual/en/reference.pcre.pattern.syntax.php
Rgds
John
---
Hello,
How do I find an exact match of a string with preg_match?
Example:
String1: www.test.com/
String2:
On Wed, 18 Aug 2004 17:16:24 +0200, Nicklas Bondesson [EMAIL PROTECTED] wrote:
Hello,
How do I find an exact match of a string with preg_match?
Example:
String1: www.test.com/
String2: www.test.com/somepage.php?param1=true
How do you write the regexp to only return String1 and not
Is it clever to use word boundary here? /b?
Nicke
From: John Legg [mailto:[EMAIL PROTECTED]
Sent: den 18 augusti 2004 18:02
To: Nicklas Bondesson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] preg_match question
Try using a pattern set to the following:
$pattern
? /b?
Nicke
From: John Legg [mailto:[EMAIL PROTECTED]
Sent: den 18 augusti 2004 18:02
To: Nicklas Bondesson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] preg_match question
Try using a pattern set to the following:
$pattern = /^www.test.com$/;
and refer to:
http
://uk.f251.mail.yahoo.com/ym/[EMAIL PROTECTED]YY=19
751order=downsort=datepos=0view=ahead=b
Subject: Re: [PHP] preg_match question
Try using a pattern set to the following:
$pattern = /^www.test.com$/;
and refer to:
http://uk.php.net/manual/en/reference.pcre.pattern.syntax.php
Rgds
John
---
Hello
* Thus wrote Nicklas Bondesson:
Actually I think I got it working now (without escaping the .).
cause . is any character
wwwatestbcom will get matched as well.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our
Nicklas Bondesson wrote:
How do I find an exact match of a string with preg_match?
Example:
String1: www.test.com/
String2: www.test.com/somepage.php?param1=true
How do you write the regexp to only return String1 and not String2 when you
match against www.test.com ??
I've heard == works well. Or
Thank you both Jason and Curt...
Looks like I was pretty close...
In fact, I found a fault in my logic, too, that meant only some but not all
instances of $element were being validated, even after i got the preg
function right! But it's all working great now.
- john
As John has previously
I am a semi-newbie at php and a complete newbie to regex
What am I doing wrong here?
function isWord($element) {
return !preg_match (/[^A-Za-z\-\(\)\s]/, $element);
}
I want to test the string $element and make sure that it contains nothing
but:
- characters A-Z
- characters a-z
On Wednesday 21 July 2004 10:04, John Van Pelt wrote:
function isWord($element) {
return !preg_match (/[^A-Za-z\-\(\)\s]/, $element);
}
I want to test the string $element and make sure that it contains nothing
but:
- characters A-Z
- characters a-z
- hyphen
-
* Thus wrote Jason Wong:
On Wednesday 21 July 2004 10:04, John Van Pelt wrote:
function isWord($element) {
return !preg_match (/[^A-Za-z\-\(\)\s]/, $element);
}
I want to test the string $element and make sure that it contains nothing
but:
- characters A-Z
- characters
Hi List,
I have managed to list files on my website using a combination of
preg_match_all and str_replace in an array.
What I would like to know is how do I lift out of a a tag the contents
from href=.
Example:
Link returned = a href=./somepage.phpOf to some page/a
The bit I want to play with
On Sat, 29 May 2004, Dave Carrera wrote:
Link returned = a href=./somepage.phpOf to some page/a
The bit I want to play with is ./somepage.php.
$str = 'a href=./somepage.phpOf to some page/a';
if( preg_match(/a href=\(.*)\/Ui, $str, $matches) )
echo $matches[1];
else
echo
of this kind.
Cheers,
Marco
--
php|architect - The Magazine for PHP Professionals
http://www.phparch.com -- Get your free issue today!
-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]
Sent: May 29, 2004 4:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Preg_match question
Hi
: Marco Tabini [mailto:[EMAIL PROTECTED]
Sent: 29 May 2004 13:32
To: 'Dave Carrera'; [EMAIL PROTECTED]
Subject: RE: [PHP] Preg_match question
I guess the simplest would be to use preg_match_all on
'/a +href=([^]+)/i'
Assuming that all your links are in that format, this will extract all
Is there a preg to find a ? in a string since a ? is used for
calculations as I see it.
You just need to escape it with a backslash, e.g. \?
Good luck,
Marco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Great quote Jeroen.
Always code as if the guy who ends up maintaining your code will be a violent
psychopath who knows where you live.
-- Martin Golding
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 03:35 22.02.2003, Andy Crain said:
[snip]
My apologies in advance if this too basic or there's a solution easily
found out there, but after lots of searching, I'm still lost.
I'm trying to build a regexp that would parse user-supplied text and
identify
, February 22, 2003 1:06 AM
To: 'Andy Crain'; [EMAIL PROTECTED]
Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
I'm trying to build a regexp that would parse user-supplied text and
identify cases where HTML tags are left open or are not properly
matched-e.g., b tags
first match, at b.
Andy
-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 5:48 AM
To: Andy Crain
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] preg_match question: locating unmatched HTML tags
At 03:35 22.02.2003, Andy Crain said
://www.phparch.com/
-Original Message-
From: Andy Crain [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 4:54 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
John,
Thanks. I'm considering that, but the application I'm working
to check the output of that to make sure there aren't any extraneous
tags.
Andy
-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 5:04 PM
To: 'Andy Crain'; [EMAIL PROTECTED]
Subject: RE: [PHP] preg_match question: locating unmatched HTML
Hi,
Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC My apologies in advance if this too basic or there's a solution easily
AC found out there, but after lots of searching, I'm still lost.
AC I'm trying to build a regexp that would parse user-supplied text and
AC identify cases where
Hi,
Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC My apologies in advance if this too basic or there's a solution easily
AC found out there, but after lots of searching, I'm still lost.
AC I'm trying to build a regexp that would parse user-supplied text and
AC identify cases where
My apologies in advance if this too basic or there's a solution easily
found out there, but after lots of searching, I'm still lost.
I'm trying to build a regexp that would parse user-supplied text and
identify cases where HTML tags are left open or are not properly
matched-e.g., b tags
I'm trying to build a regexp that would parse user-supplied text and
identify cases where HTML tags are left open or are not properly
matched-e.g., b tags without closing /b tags. This is for a sort
of
message board type of application, and I'd like to allow users to use
some HTML, but just
30 matches
Mail list logo