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
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
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
>
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 str
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';
> }
>
H
> 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.
> 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 rec
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_.'
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 t
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 {
> 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 b
> 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 interpr
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 fails
# [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 objecti
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
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() [fu
> -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
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 oth
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 \
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 a
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 the
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
L PROTECTED]
> 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
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
> > http://hu2.php.net/
# [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
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(): Unkno
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'])
>> whe
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("fo
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"); // t
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:
preg_match(
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 f
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, vis
> 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 o
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 to
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+\((.+)\)$",
$this->_
35 matches
Mail list logo