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
Beauford wrote: 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 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
You need to escape that forward slash in the character class: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ Also, you've got only two backslashes in your char class. PHP is reducing this to a single backslash before the space character. I think you intend this to be two

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
Beauford wrote: You need to escape that forward slash in the character class: preg_match(/[EMAIL PROTECTED]()*;:_.'\/ Also, you've got only two backslashes in your char class. PHP is reducing this to a single backslash before the space character. I think you intend this to be

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
At 1/22/2007 04:56 PM, Beauford wrote: 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 error. Warning: preg_match()

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

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,

Re: [PHP] preg_match problem

2006-08-21 Thread Dave Goodchild
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 number between 1 and 6. Thanks for any help. the pattern is

Re: [PHP] preg_match problem

2006-08-21 Thread Alex Turner
I think this pattern would also match form16.php etc, which I think is not what afan wanted. 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:

Re: [PHP] preg_match problem

2006-08-21 Thread afan
Works perfect. Thanks! ;) -afan function doMatch($f) { echo $f, = , (preg_match(#^form[1-6]\.php\$#,basename($f))?true:false), \n; } doMatch(form1.php); // true doMatch(form2.php); // true doMatch(form3.php); // true doMatch(form4.php);

Re: [PHP] preg_match problem

2006-08-21 Thread Jochem Maas
function doMatch($f) { echo $f, = , (preg_match(#^form[1-6]\.php\$#,basename($f))?true:false), \n; } doMatch(form1.php); // true doMatch(form2.php); // true doMatch(form3.php); // true doMatch(form4.php); // true doMatch(form5.php); //

[PHP] preg_match problem/question

2003-04-04 Thread Jason Borgmann
I am getting an error on the following line: if(preg_match('s/l$//', $string)) The error is: Warning: Delimiter must not be alphanumeric or backslash in /u1/jab/devel/whitespace/whitespace.php on line 136. I know that pcre in PHP is not exactly interchangeable. Any ideas on how to get this

RE: [PHP] preg_match problem/question

2003-04-04 Thread John W. Holmes
I am getting an error on the following line: if(preg_match('s/l$//', $string)) The error is: Warning: Delimiter must not be alphanumeric or backslash in /u1/jab/devel/whitespace/whitespace.php on line 136. I know that pcre in PHP is not exactly interchangeable. Any ideas on how to

[PHP] preg_match problem

2002-09-29 Thread Chris N
Ok heres the situation, I have a string like this $this-_item[title] = 28.09.02 - Some silly Text (First) (Second); Im trying to do a preg_match on it to check it to make sure its in a certian format. Heres my preg_match preg_match(/^(\d+)\.(\d+)\.(\d+)\s+\-\s+(.+)\s+\((.+)\)$,