[PHP] preg_match question...

2009-02-06 Thread bruce
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

Re: [PHP] preg_match question...

2009-02-06 Thread Alpár Török
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

Re: [PHP] preg_match question...

2009-02-06 Thread Jim Lucas
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

[PHP] preg_match question

2004-08-18 Thread Nicklas Bondesson
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

Re: [PHP] preg_match question

2004-08-18 Thread John Legg
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:

Re: [PHP] preg_match question

2004-08-18 Thread Matt M.
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

RE: [PHP] preg_match question

2004-08-18 Thread Nicklas Bondesson
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

RE: [PHP] preg_match question

2004-08-18 Thread John Legg
? /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

RE: [PHP] preg_match question

2004-08-18 Thread Nicklas Bondesson
://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

Re: [PHP] preg_match question

2004-08-18 Thread Curt Zirzow
* 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

Re: [PHP] preg_match question

2004-08-18 Thread John Holmes
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

Re: [PHP] preg_match question

2004-07-21 Thread John Van Pelt
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

[PHP] preg_match question

2004-07-20 Thread John Van Pelt
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

Re: [PHP] preg_match question

2004-07-20 Thread 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 a-z - hyphen -

Re: [PHP] preg_match question

2004-07-20 Thread Curt Zirzow
* 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

[PHP] Preg_match question

2004-05-29 Thread Dave Carrera
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

Re: [PHP] Preg_match question

2004-05-29 Thread Jeroen Serpieters
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

RE: [PHP] Preg_match question

2004-05-29 Thread Marco Tabini
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

RE: [PHP] Preg_match question

2004-05-29 Thread Dave Carrera
: 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

RE: [PHP] Preg_match question

2004-05-29 Thread Marco Tabini
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

Re: [PHP] Preg_match question

2004-05-29 Thread Daniel Clark
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

Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Ernest E Vogelsinger
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

RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
, 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

RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
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

RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread John W. Holmes
://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

RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
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

Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Tom Rogers
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

Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Tom Rogers
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

[PHP] preg_match question: locating unmatched HTML tags

2003-02-21 Thread Andy Crain
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

RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-21 Thread John W. Holmes
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