Re: [PHP] preg_match fails to resolve variable as a subject

2010-12-03 Thread Da Rock
On 12/03/10 16:33, Tamara Temple wrote: On Dec 2, 2010, at 11:33 PM, Da Rock wrote: On 11/29/10 09:10, Richard Quadling wrote: On 27 November 2010 04:45, Da Rockphp-l...@herveybayaustralia.com.au wrote: On 11/27/10 13:51, Tamara Temple wrote: On Nov 26, 2010, at 7:28 PM, Da Rock wrote:

Re: [PHP] preg_match fails to resolve variable as a subject

2010-12-03 Thread Richard Quadling
On 3 December 2010 11:13, Da Rock php-l...@herveybayaustralia.com.au wrote: On 12/03/10 16:33, Tamara Temple wrote: On Dec 2, 2010, at 11:33 PM, Da Rock wrote: On 11/29/10 09:10, Richard Quadling wrote: On 27 November 2010 04:45, Da Rockphp-l...@herveybayaustralia.com.au  wrote: On

Re: [PHP] preg_match fails to resolve variable as a subject

2010-12-03 Thread Richard Quadling
On 3 December 2010 11:13, Da Rock php-l...@herveybayaustralia.com.au wrote: On 12/03/10 16:33, Tamara Temple wrote: On Dec 2, 2010, at 11:33 PM, Da Rock wrote: On 11/29/10 09:10, Richard Quadling wrote: On 27 November 2010 04:45, Da Rockphp-l...@herveybayaustralia.com.au  wrote: On

Re: [PHP] preg_match fails to resolve variable as a subject

2010-12-02 Thread Da Rock
On 11/29/10 09:10, Richard Quadling wrote: On 27 November 2010 04:45, Da Rockphp-l...@herveybayaustralia.com.au wrote: On 11/27/10 13:51, Tamara Temple wrote: On Nov 26, 2010, at 7:28 PM, Da Rock wrote: On 11/27/10 00:57, Richard Quadling wrote: On 26 November

Re: [PHP] preg_match fails to resolve variable as a subject

2010-12-02 Thread Tamara Temple
On Dec 2, 2010, at 11:33 PM, Da Rock wrote: On 11/29/10 09:10, Richard Quadling wrote: On 27 November 2010 04:45, Da Rockphp- l...@herveybayaustralia.com.au wrote: On 11/27/10 13:51, Tamara Temple wrote: On Nov 26, 2010, at 7:28 PM, Da Rock wrote: On 11/27/10 00:57, Richard Quadling

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-28 Thread Richard Quadling
On 27 November 2010 04:45, Da Rock php-l...@herveybayaustralia.com.au wrote: On 11/27/10 13:51, Tamara Temple wrote: On Nov 26, 2010, at 7:28 PM, Da Rock wrote: On 11/27/10 00:57, Richard Quadling wrote: On 26 November 2010 00:07, Da Rockphp-l...@herveybayaustralia.com.au  wrote:

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-26 Thread Richard Quadling
On 26 November 2010 00:07, Da Rock php-l...@herveybayaustralia.com.au wrote: preg_match(/(\d{1,3})(\.)$/, exec($mixer . ' ' . $command), $matches) Can you ... var_dump(exec($mixer . ' ' . $command)); I wonder if the output includes a new line which you are not accounting for in the regex. --

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-26 Thread Tamara Temple
On Nov 25, 2010, at 6:07 PM, Da Rock wrote: preg_match(/(\d{1,3})(\.)$/, exec($mixer . ' ' . $command), $matches) it looks like you're failing to account for the newline that comes back in a command execution. Add trim() around the exec() call and try again. -- PHP General Mailing List

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-26 Thread Da Rock
On 11/27/10 00:57, Richard Quadling wrote: On 26 November 2010 00:07, Da Rockphp-l...@herveybayaustralia.com.au wrote: preg_match(/(\d{1,3})(\.)$/, exec($mixer . ' ' . $command),$matches) Can you ... var_dump(exec($mixer . ' ' . $command)); I wonder if the output includes a new

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-26 Thread Tamara Temple
On Nov 26, 2010, at 7:28 PM, Da Rock wrote: On 11/27/10 00:57, Richard Quadling wrote: On 26 November 2010 00:07, Da Rockphp- l...@herveybayaustralia.com.au wrote: preg_match(/(\d{1,3})(\.)$/, exec($mixer . ' ' . $command), $matches) Can you ... var_dump(exec($mixer . ' ' .

Re: [PHP] preg_match fails to resolve variable as a subject

2010-11-26 Thread Da Rock
On 11/27/10 13:51, Tamara Temple wrote: On Nov 26, 2010, at 7:28 PM, Da Rock wrote: On 11/27/10 00:57, Richard Quadling wrote: On 26 November 2010 00:07, Da Rockphp-l...@herveybayaustralia.com.au wrote: preg_match(/(\d{1,3})(\.)$/, exec($mixer . ' ' . $command),$matches) Can you ...

[PHP] preg_match fails to resolve variable as a subject

2010-11-25 Thread Da Rock
I have been scratching on this for some time now, and throughout I've been trying subscribe to this list. Pardon if this is a stupid question, but I googled for days on this and still couldn't get it to work. Is there a known issue with php's preg_match? I can get it to work on a string

[PHP] preg_match? Or something else?

2010-04-02 Thread Ashley M. Kirchner
I have an array that's created as follows: $string = 73G146C 311- 309.1C; $arr = preg_split(/[\s]+/, $string); Now I need to take each element in that array, and break them up even further so that I get: 73G= 73 and G 146C = 146 and C 311- = 311 and - 309.1C =

Re: [PHP] preg_match? Or something else?

2010-04-02 Thread Jim Lucas
Ashley M. Kirchner wrote: I have an array that's created as follows: $string = 73G146C 311- 309.1C; $arr = preg_split(/[\s]+/, $string); Now I need to take each element in that array, and break them up even further so that I get: 73G= 73 and G 146C =

Re: [PHP] preg_match? Or something else?

2010-04-02 Thread Nathan Rixham
Jim Lucas wrote: Ashley M. Kirchner wrote: I have an array that's created as follows: $string = 73G146C 311- 309.1C; Anyone want to take a stab at it? Conditionals are your friend! plaintext?php $string = 73G146C 311- 309.1C; $arr = preg_split(/[\s]+/,

[PHP] preg_match()

2009-09-09 Thread Jan Reiter
Good Afternoon. This shouldn't be too complicated, but I can't come up with a solution for the problem right now. It's about RegEx in PHP (5.2) Is there a way to capture ALL sub elements of an expression like preg_match('@a(?[0-9])*b@' ,a2345678b , $matches); ?? This would produce

Re: [PHP] preg_match()

2009-09-09 Thread Ashley Sheridan
On Wed, 2009-09-09 at 18:18 +0200, Jan Reiter wrote: Good Afternoon. This shouldn't be too complicated, but I can't come up with a solution for the problem right now. It's about RegEx in PHP (5.2) Is there a way to capture ALL sub elements of an expression like

RE: [PHP] preg_match()

2009-09-09 Thread Jan Reiter
to avoid. But maybe that's what I have to after all if there is no other way. Thanks Regards, Jan -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Wednesday, September 09, 2009 6:21 PM To: Jan Reiter Cc: php-general@lists.php.net Subject: Re: [PHP] preg_match

RE: [PHP] preg_match()

2009-09-09 Thread Jan Reiter
Thanks! Thats about what I'm doing right now. function parse_prim_states($in) { preg_match('@prim_states[\s]*\((?number[0-9\s]*)@' ,$in , $matches); $this-num_prim_states = (int)$matches['number'];

[PHP] preg_match doesn't match Greek

2009-09-01 Thread Thodoris
Hi gang, I am trying to make a form validation using preg_match and it fails. I think it is because the input is in Greek. I have made this script: $str = ΕΕΝ 5196; $pattern = /^[[:alnum:]\s\-\,]*$/u; echo 'pre'; print preg_match($pattern,$str,$matches).\n; print_r($matches); to test

RE: [PHP] preg_match too greedy

2009-07-31 Thread Ford, Mike
-Original Message- From: b [mailto:p...@logi.ca] Sent: 30 July 2009 03:17 echo (preg_match($pattern, $test) != false) The != false here is redundant. Understood. But what you think is redundancy is, to me, clarity in programming. I happen to think that boolean tests

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
echo (preg_match($pattern, $test) != false) The != false here is redundant. Understood. But what you think is redundancy is, to me, clarity in programming. I happen to think that boolean tests shouldn't ride on whether or not an array returned from a function is empty or not (or a

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
Ben Dunlap wrote: have -- ($x != false) -- will be true whether $x is 0, NULL, an empty string, [8] But $x !== false will only be true in the last case. Sorry, replace be true with be false above. -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] preg_match too greedy

2009-07-29 Thread b
I'm trying to figure out how to test if a string matches *exactly* another string, using a regexp pattern. The manual says that ereg() is deprecated (in favour of what?) and preg_match() is giving me trouble. The problem is that I'm passing the end-of-line delimiter ($) but it seems to be

Re: [PHP] preg_match too greedy

2009-07-29 Thread Ben Dunlap
Jim Lucas wrote: I expected 'no match' but get 'match'. [8] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? If I might suggest a couple of simplifications that would make it easier to

Re: [PHP] preg_match too greedy

2009-07-29 Thread Jim Lucas
Ben Dunlap wrote: Jim Lucas wrote: I expected 'no match' but get 'match'. [8] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 11 2008

Re: [PHP] preg_match too greedy

2009-07-29 Thread Daniel Kolbo
Jim Lucas wrote: Ben Dunlap wrote: Jim Lucas wrote: I expected 'no match' but get 'match'. [8] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built:

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 02:07 PM, Jim Lucas wrote: b wrote: I'm trying to figure out how to test if a string matches *exactly* another string, using a regexp pattern. The manual says that ereg() is deprecated (in favour of what?) and preg_match() is giving me trouble. The problem is that I'm passing the

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 03:03 PM, Ben Dunlap wrote: Jim Lucas wrote: I expected 'no match' but get 'match'. [8] cut/paste your code and it works for me. Works for me as well. I get 'no match' from PHP 5.1.2, 5.2.6, and 5.2.8. What version do you have? 5.2.9 If I might suggest a couple of

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 07:48 PM, Daniel Kolbo wrote: code works (no match) for me too on php 5.2.6 build date May 2 2008 18:01:20 with dumbdows NT. preg_match fails but for a reason other than what I think you may be expecting. It fails b/c of the first forwards slash in $url. The regex engine

Re: [PHP] preg_match too greedy

2009-07-29 Thread Daniel Kolbo
b wrote: On 07/29/2009 07:48 PM, Daniel Kolbo wrote: code works (no match) for me too on php 5.2.6 build date May 2 2008 18:01:20 with dumbdows NT. preg_match fails but for a reason other than what I think you may be expecting. It fails b/c of the first forwards slash in $url. The regex

Re: [PHP] preg_match too greedy

2009-07-29 Thread b
On 07/29/2009 11:18 PM, Daniel Kolbo wrote: b wrote: On 07/29/2009 07:48 PM, Daniel Kolbo wrote: code works (no match) for me too on php 5.2.6 build date May 2 2008 18:01:20 with dumbdows NT. preg_match fails but for a reason other than what I think you may be expecting. It fails b/c of the

[PHP] preg_match and multibyte

2009-04-09 Thread Merlin Morgenstern
Hello, I am trying to extract a number out of a string that is in utf-8 and contains chines characters. This unfortunatelly does not work: preg_match('{(\d+)}', $details, $m); $number = $m[1]; I also tried to utf8decode it, but still, no luck. Does anybody

Re: [PHP] preg_match and multibyte

2009-04-09 Thread tedd
At 4:18 PM +0200 4/9/09, Merlin Morgenstern wrote: Hello, I am trying to extract a number out of a string that is in utf-8 and contains chines characters. This unfortunatelly does not work: preg_match('{(\d+)}', $details, $m); $number = $m[1]; I also tried

Re: [PHP] preg_match and multibyte

2009-04-09 Thread Merlin Morgenstern
tedd wrote: At 4:18 PM +0200 4/9/09, Merlin Morgenstern wrote: Hello, I am trying to extract a number out of a string that is in utf-8 and contains chines characters. This unfortunatelly does not work: preg_match('{(\d+)}', $details, $m); $number = $m[1]; I also tried to

[PHP] preg_match and dates

2009-03-02 Thread Michael A. Peters
I have absolutely no control over the source file. The source file is an xml file (er, sort of, it doesn't follow any particular DTD) and has a tag called VERBATIM_DATE in each record - looks to be required in their output as every record so far has it, but w/o a DTD hard to know - time of

Re: [PHP] preg_match and dates

2009-03-02 Thread Per Jessen
Michael A. Peters wrote: What I'm trying to do is write a preg matches for each case I come across - if it matches the preg, it then parses according to the pattern to get me an acceptable -MM-DD (not sure how I'll deal with the season case yet ... but I'm serious, that kind of thing in

Re: [PHP] preg_match and dates

2009-03-02 Thread Per Jessen
Michael A. Peters wrote: This is what I have so far - $pattern[] = /^([0-9]{1,2})[\s-]([A-Z][a-z]*)[\s-]([0-9]{4,4})$/i; $clean[] = \\3-\\2-\\1; $pattern[] = /^([A-Z][a-z]*)[\s-]([0-9]{4,4})$/; $clean[] = \\2-\\1-01; $foo = preg_replace($pattern, $clean, $verb_date); If I were you, I'd

Re: [PHP] preg_match and dates

2009-03-02 Thread Michael A. Peters
Per Jessen wrote: Michael A. Peters wrote: What I'm trying to do is write a preg matches for each case I come across - if it matches the preg, it then parses according to the pattern to get me an acceptable -MM-DD (not sure how I'll deal with the season case yet ... but I'm serious, that

[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

2008-10-27 Thread Alex Chamberlain
Hi, I don’t understand regular expressions at all – I will make an effort to learn about them one day, but I need a solution today. I want to use the __autoload function, but not for all my class only those that finish in ‘Controller’. So for instance, ‘ErrorController’ should load

Re: [PHP] preg_match

2008-10-27 Thread Stut
On 27 Oct 2008, at 15:08, Alex Chamberlain wrote: I don’t understand regular expressions at all – I will make an effort to learn about them one day, but I need a solution today. I want to use the __autoload function, but not for all my class only those that finish in ‘Controller’. So for

RE: [PHP] preg_match

2008-10-27 Thread Alex Chamberlain
-Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: 27 October 2008 15:21 To: Alex Chamberlain Cc: PHP General list Subject: Re: [PHP] preg_match On 27 Oct 2008, at 15:08, Alex Chamberlain wrote: I don’t understand regular expressions at all – I will make an effort

Re: [PHP] preg_match

2008-10-27 Thread Stut
On 27 Oct 2008, at 15:46, Alex Chamberlain wrote: Problem solved: function __autoload($c) { $m = array(); preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m); if (count($m)) { require_once(realpath(FS_CONTROLLER . '/' . strtolower($m[0]) . '.inc.php')); } } However (perhaps a more

Re: [PHP] preg_match

2008-10-27 Thread Eric Butera
On Mon, Oct 27, 2008 at 11:54 AM, Stut [EMAIL PROTECTED] wrote: On 27 Oct 2008, at 15:46, Alex Chamberlain wrote: Problem solved: function __autoload($c) { $m = array(); preg_match('/(?:^[A-Z][a-z]+)Controller/', $c, $m); if (count($m)) { require_once(realpath(FS_CONTROLLER . '/' .

Re: [PHP] preg_match

2008-10-27 Thread Stut
Please keep the conversation on the list! On 27 Oct 2008, at 16:06, Alex Chamberlain wrote: -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: 27 October 2008 15:54 To: Alex Chamberlain Cc: 'PHP General list' Subject: Re: [PHP] preg_match On 27 Oct 2008, at 15:46, Alex

RE: [PHP] preg_match

2008-10-27 Thread Boyd, Todd M.
-Original Message- From: Alex Chamberlain [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2008 10:09 AM To: PHP General list Subject: [PHP] preg_match Hi, I don't understand regular expressions at all - I will make an effort to learn about them one day, but I need

Re: [PHP] preg_match() returns false but no documentation why

2007-05-31 Thread Richard Lynch
On Wed, May 30, 2007 4:25 pm, Jared Farrish wrote: On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: If you can't find them documented, print them out: echo PREG_NO_ERROR: ', PREG_NO_ERROR, '; Doh! PREG_NO_ERROR: 0 PREG_INTERNAL_ERROR: 1 PREG_BACKTRACK_LIMIT_ERROR: 2

Re: [PHP] preg_match() returns false but no documentation why

2007-05-31 Thread Richard Lynch
On Wed, May 30, 2007 5:04 pm, Jim Lucas wrote: btw: why is there a period in the second pattern? Also, why are you allowing for uppercase letters when the RFC's don't allow them? LDAP URL domain can't be ALL CAPS?! Last I heard, domain names were case-insensitive in every other URL... --

[PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Jared Farrish
Hi all, Can anybody spot why this doesn't seem to be working right? The manual ( http://us2.php.net/preg_match) says it returns false on error, but preg_last_error() returns 0, which I assume points to the PREG_NO_ERROR error code. code

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Richard Lynch
On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote: Hi all, Can anybody spot why this doesn't seem to be working right? The manual ( http://us2.php.net/preg_match) says it returns false on error, but preg_last_error() returns 0, which I assume points to the PREG_NO_ERROR error code. code

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Jared Farrish
On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote: preg_match(^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$,$this-server) You are missing the start/end delimiters is your first problem... Which ones? I've got the starter ^ and the closer $,

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Stut
Jared Farrish wrote: On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote: preg_match(^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$,$this-server) You are missing the start/end delimiters is your first problem... Which ones? I've got the starter

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Richard Lynch
On Wed, May 30, 2007 3:06 pm, Jared Farrish wrote: On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote: preg_match(^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$,$this-server) You are missing the start/end delimiters is your first problem...

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Jared Farrish
On 5/30/07, Stut [EMAIL PROTECTED] wrote: You need delimiters around the regex, as stated in the documentation. preg_match(/^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/,$this-server) Although you don't need to use slashes, you can use any character you want but you must escape it in if it

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Richard Lynch
On Wed, May 30, 2007 3:25 pm, Jared Farrish wrote: On 5/30/07, Stut [EMAIL PROTECTED] wrote: You need delimiters around the regex, as stated in the documentation. preg_match(/^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/,$this-server) Although you don't need to use slashes, you can use any

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Jared Farrish
On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: If you can't find them documented, print them out: echo PREG_NO_ERROR: ', PREG_NO_ERROR, '; Doh! PREG_NO_ERROR: 0 PREG_INTERNAL_ERROR: 1 PREG_BACKTRACK_LIMIT_ERROR: 2 PREG_RECURSION_LIMIT_ERROR: 3 PREG_BAD_UTF8_ERROR: 4 So apparently,

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Jim Lucas
Stut wrote: Jared Farrish wrote: On 5/30/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, May 30, 2007 12:33 pm, Jared Farrish wrote: preg_match(^ldap(s)?://[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$,$this-server) You are missing the start/end delimiters is your first problem... Which ones? I've

Re: [PHP] preg_match() returns false but no documentation why

2007-05-30 Thread Crayon Shin Chan
On Thursday 31 May 2007 01:33, Jared Farrish wrote: Can anybody spot why this doesn't seem to be working right? The manual ( http://us2.php.net/preg_match) says it returns false on error, but preg_last_error() returns 0, which I assume points to the PREG_NO_ERROR error code. code

[PHP] preg_match

2007-02-06 Thread James Lockie
I am trying to use this code to display a button at the root but it always displays the button. :-( if (! (preg_match( /$\/index.php/, $_SERVER['PHP_SELF'] ))) { # display a button -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] preg_match

2007-02-06 Thread Richard Lynch
On Tue, February 6, 2007 7:46 pm, James Lockie wrote: I am trying to use this code to display a button at the root but it always displays the button. :-( if (! (preg_match( /$\/index.php/, $_SERVER['PHP_SELF'] ))) { Without any modifier, $ matches the END of the string. It is impossible

Re: [PHP] preg_match

2007-02-06 Thread Myron Turner
James Lockie wrote: I am trying to use this code to display a button at the root but it always displays the button. :-( if (! (preg_match( /$\/index.php/, $_SERVER['PHP_SELF'] ))) { # display a button You got the end-of-string character ($) in the wrong place: if (! (preg_match(

Re: [PHP] preg_match

2007-02-06 Thread James Lockie
Myron Turner wrote: James Lockie wrote: I am trying to use this code to display a button at the root but it always displays the button. :-( if (! (preg_match( /$\/index.php/, $_SERVER['PHP_SELF'] ))) { # display a button You got the end-of-string character ($) in the wrong place: if

Re: [PHP] preg_match problem

2007-01-25 Thread Jim Lucas
Beauford wrote: Here is my rendition of what I think you are looking for. $str = 'tab()/space( )/[EMAIL PROTECTED]*();:...'; if ( preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|', $str) ) { echo 'success'; } else { echo 'failure'; } Here is the problem, and it is

RE: [PHP] preg_match problem

2007-01-25 Thread Beauford
Hi Jim, Thanks for all the help, but where is the link. Here is a link to a page that has this on it, but with the added ' Plus a link to the source code for it. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --

Re: [PHP] preg_match problem

2007-01-25 Thread Jim Lucas
sorry that is what I get for sending things that early in the morning. :( http://www.cmsws.com/examples/php/preg_match/example01.php -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all

Re: [PHP] preg_match problem

2007-01-25 Thread Richard Lynch
On Thu, January 25, 2007 9:53 am, Jim Lucas wrote: http://www.cmsws.com/examples/php/preg_match/example01.php The \t inside of '' has no special meaning. So you don't have a TAB character in there. You need to get \t to mean TAB Once you do that, you should then escape the $ with \$ instead

RE: [PHP] preg_match problem

2007-01-24 Thread Beauford
Here is my rendition of what I think you are looking for. $str = 'tab( )/space( )/[EMAIL PROTECTED]*();:...'; if ( preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|', $str) ) { echo 'success'; } else { echo 'failure'; } Here is the problem, and it is strange. If I enter

RE: [PHP] preg_match problem

2007-01-24 Thread Paul Novitski
At 1/24/2007 01:13 PM, Beauford wrote: Here is my rendition of what I think you are looking for. $str = 'tab( )/space( )/[EMAIL PROTECTED]*();:...'; if ( preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|', $str) ) { echo 'success'; } else { echo 'failure'; } Here is the

Re: [PHP] preg_match problem

2007-01-23 Thread Martin Alterisio
2007/1/22, Beauford [EMAIL PROTECTED]: ... much blah blah blah ... I've probably read 100 pages on this, and no matter what I try it doesn't work. Including all of what you suggested above - is my PHP possessed? if(preg_match(/[EMAIL PROTECTED]()*;:_.'/\\ ]+$/, $string)) { gives me this

Re: [PHP] preg_match problem

2007-01-23 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-23 09:52:17 -0300: 2007/1/22, Beauford [EMAIL PROTECTED]: PS: Will we be risking going the perl way if we ask that PHP supported regular expressions natively (I mean: without having to provide them as strings)? Yes. I don't know about other people's objections

Re: [PHP] preg_match problem

2007-01-23 Thread Paul Novitski
At 1/23/2007 04:52 AM, Martin Alterisio wrote: if (preg_match('/[EMAIL PROTECTED]()*;:_.'\\/ ]+$/', $string)) Close but no cigar. Because you're using apostrophe to quote the expression, PHP interprets the apostrophe inside the character class as ending the quoted expressions and

RE: [PHP] preg_match problem

2007-01-23 Thread Beauford
if (preg_match('/[EMAIL PROTECTED]()*;:_.'\\/ ]+$/', $string)) Use single quotes and double back-slashes. PHP strings also have escape sequences that use the back-slash as escape character, that's why you have to double them. And single quotes to avoid the $ character interpreted

RE: [PHP] preg_match problem

2007-01-23 Thread Beauford
backslashes in the pattern so you need four backslashes in PHP: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ ]+$/, $string) On top of this, every time a ' is entered it gets preceded by \. If I just check for the characters like below that doesn't happen. Totally confused. if(preg_match

Re: [PHP] preg_match problem

2007-01-23 Thread Jim Lucas
if (preg_match('/[EMAIL PROTECTED]()*;:_.'\\/ ]+$/', $string)) Here is my rendition of what I think you are looking for. $str = 'tab()/space( )/[EMAIL PROTECTED]*();:...'; if ( preg_match('|[EMAIL PROTECTED]*();:_. /\t-]+$|', $str) ) { echo 'success'; } else {

Re: [PHP] preg_match problem

2007-01-23 Thread Jim Lucas
this to be two backslashes in the pattern so you need four backslashes in PHP: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ ]+$/, $string) On top of this, every time a ' is entered it gets preceded by \. If I just check for the characters like below that doesn't happen. Totally confused

RE: [PHP] preg_match problem

2007-01-23 Thread Paul Novitski
At 1/23/2007 09:50 AM, Beauford wrote: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ ]+$/, $string) On top of this, every time a ' is entered it gets preceded by \. If I just check for the characters like below that doesn't happen. Totally confused. if(preg_match(/^[-A-Za-z0-9_.' ]+$/,

RE: [PHP] preg_match problem

2007-01-23 Thread Beauford
You don't need to escape the apostrophe if the pattern isn't quoted with apostrophes in PHP or delimited by apostrophes in the PREG pattern. But generally there's no harm in escaping characters unnecessarily; it just makes for messier code. Here is a simple test of the regexp I

[PHP] preg_match problem

2007-01-22 Thread Beauford
I'm trying to get this but not quite there. I want to allow the following characters. [EMAIL PROTECTED]()*;:_.'/\ and a space. Is there a special order these need to be in or escaped somehow. For example, if I just allow _' the ' is fine, if I add the other characters, the ' gets preceded by a \

Re: [PHP] preg_match problem

2007-01-22 Thread Paul Novitski
At 1/22/2007 03:04 PM, Beauford wrote: I'm trying to get this but not quite there. I want to allow the following characters. [EMAIL PROTECTED]()*;:_.'/\ and a space. Is there a special order these need to be in or escaped somehow. For example, if I just allow _' the ' is fine, if I add the

RE: [PHP] preg_match problem

2007-01-22 Thread Beauford
-Original Message- From: Paul Novitski [mailto:[EMAIL PROTECTED] Sent: January 22, 2007 6:58 PM To: PHP Subject: Re: [PHP] preg_match problem At 1/22/2007 03:04 PM, Beauford wrote: I'm trying to get this but not quite there. I want to allow the following characters

RE: [PHP] preg_match problem

2007-01-22 Thread Paul Novitski
is reducing this to a single backslash before the space character. I think you intend this to be two backslashes in the pattern so you need four backslashes in PHP: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ ]+$/, $string) Regards, Paul __ Juniper Webcraft

Re: [PHP] preg_match problem

2007-01-21 Thread Martin Alterisio
2007/1/20, Arpad Ray [EMAIL PROTECTED]: Martin Alterisio wrote: Double slash to prevent PHP interpreting the slashes. Also using single quotes would be a good idea: if (preg_match('/[\\w\\x2F]{6,}/',$a)) Just switching to single quotes would do the trick - you don't need to escape

Re: [PHP] preg_match problem

2007-01-20 Thread Martin Alterisio
Double slash to prevent PHP interpreting the slashes. Also using single quotes would be a good idea: if (preg_match('/[\\w\\x2F]{6,}/',$a)) 2007/1/19, Németh Zoltán [EMAIL PROTECTED]: Hi all, I have a simple checking like if (preg_match(/[\w\x2F]{6,}/,$a)) as I would like to allow all

Re: [PHP] preg_match problem

2007-01-20 Thread Arpad Ray
Martin Alterisio wrote: Double slash to prevent PHP interpreting the slashes. Also using single quotes would be a good idea: if (preg_match('/[\\w\\x2F]{6,}/',$a)) Just switching to single quotes would do the trick - you don't need to escape anything but single quotes, and backslashes if

[PHP] preg_match problem

2007-01-19 Thread Németh Zoltán
Hi all, I have a simple checking like if (preg_match(/[\w\x2F]{6,}/,$a)) as I would like to allow all word characters as mentioned at http://hu2.php.net/manual/hu/reference.pcre.pattern.syntax.php plus the '/' character, and at least 6 characters. But it throws Warning: preg_match(): Unknown

Re: [PHP] preg_match problem

2007-01-19 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-19 15:25:38 +0100: Hi all, I have a simple checking like if (preg_match(/[\w\x2F]{6,}/,$a)) as I would like to allow all word characters as mentioned at http://hu2.php.net/manual/hu/reference.pcre.pattern.syntax.php plus the '/' character, and at least 6

Re: [PHP] preg_match problem

2007-01-19 Thread Németh Zoltán
On p, 2007-01-19 at 15:39 +, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-19 15:25:38 +0100: Hi all, I have a simple checking like if (preg_match(/[\w\x2F]{6,}/,$a)) as I would like to allow all word characters as mentioned at

RE: [PHP] preg_match problem

2007-01-19 Thread Tim
] Envoyé : vendredi 19 janvier 2007 15:26 À : php-general@lists.php.net Objet : [PHP] preg_match problem Hi all, I have a simple checking like if (preg_match(/[\w\x2F]{6,}/,$a)) as I would like to allow all word characters as mentioned at http://hu2.php.net/manual/hu

[PHP] preg_match to preg_replace

2006-12-11 Thread Peter Lauri
Hi guys, I have a sample string [hp-ex][log]peter[hall o] that I need to process. I need to remove the [] and separate the sections with a space. If there are more then one [] part the first part should be bold (add b/b around it). I have a solution that is working very well, but am thinking that

Re: [PHP] Preg_match - Find URL and convert to lower case

2006-12-01 Thread Richard Lynch
On Thu, November 30, 2006 5:04 pm, Kevin Murphy wrote: Well the problem would be then that the entire string would be lower case, and I only can have the link as lower case. Is there a way to apply strtolower into the preg_match? Why not use lower(link) in SQL to get the link out in the first

Re: [PHP] Preg_match - Find URL and convert to lower case

2006-12-01 Thread Kevin Murphy
On Dec 1, 2006, at 1:56 PM, Richard Lynch wrote: On Thu, November 30, 2006 5:04 pm, Kevin Murphy wrote: Well the problem would be then that the entire string would be lower case, and I only can have the link as lower case. Is there a way to apply strtolower into the preg_match? Why not use

[PHP] Preg_match - Find URL and convert to lower case

2006-11-30 Thread Kevin Murphy
I have some text that comes out of a database all in uppercase (old IBM Mainframe that only supports uppercase characters). Occasionally there are web addresses in this text and so I am trying to find them, convert them to a link, and convert them all to all lower case. Yes, I know that

Re: [PHP] Preg_match - Find URL and convert to lower case

2006-11-30 Thread Dave Goodchild
Why not use strtolower on the string after the replacements have been made? -- http://www.web-buddha.co.uk

Re: [PHP] Preg_match - Find URL and convert to lower case

2006-11-30 Thread Kevin Murphy
Well the problem would be then that the entire string would be lower case, and I only can have the link as lower case. Is there a way to apply strtolower into the preg_match? -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu

[PHP] Re: SOLVED: [PHP] Preg_match - Find URL and convert to lower case

2006-11-30 Thread Kevin Murphy
$section_notes = preg_replace('/WWW.(.*?) /e', 'a href=\http:// www. . strtolower($1) . \ target=\_blank\http://www.; . strtolower($1) . /a', $section_notes); For some reason I can't get it to work if I decare those items as variables. They have to be inside the preg_replace as written.

Re: [PHP] preg_match problem

2006-08-22 Thread Richard Lynch
On Mon, August 21, 2006 2:13 pm, Dave Goodchild wrote: On 21/08/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi. I have to check if the script file belongs to any ov form1.php to form6.php files. Need something like: preg_match('/form*.php/', $_SERVER['PHP_SELF']) wher * kan be any

[PHP] preg_match problem

2006-08-21 Thread afan
hi. I have to check if the script file belongs to any ov form1.php to form6.php files. Need something like: preg_match('/form*.php/', $_SERVER['PHP_SELF']) wher * kan be any number between 1 and 6. Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

  1   2   3   >