[PHP] Re: Match anything between two " that is not a " except if it is escaped...

2008-01-18 Thread Nikolay Ananiev
This is for double quotes:
'/"[^"]*(?:.[^"]*)*"/'

this is for single:
'/\'[^\']*(?:.[^\']*)*\'/'

i took these from the smarty compiler class.


"mathieu leddet" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hi everyone,

I am struggling with regular expression trying to match strings
delimited by double quotes, but taking into consideration that \" is not
a string ending character.

---8<---
-

$in = 'this is a string : "Hi everyone my name is \"Mathieu\"!" Here is
a second string : "PHP is just perfect"';

// pattern for catching strings between "
$pattern = '#"([^"]*)"#';

// surround matching string with HTML span code to highlight
$replacement = '"${1}"';

// perform the reg exp replacement
$out = preg_replace($pattern, $replacement, $in);

---8<---
-

$out contains :
this is a string : "Hi everyone my name is \"Mathieu\"!"
Here is a second string : "PHP is just perfect"

This behaviour is normal considering my pattern (anything between two "
that is not a ").
But I don't know how to get this :
this is a string : "Hi everyone my name is \"Mathieu\"!" Here is
a second string : "PHP is just perfect"

I would like my pattern to express : Anything between two " that is not
a " except if it is escaped.

Thanks for reading me, any help in return is welcome !


--
Mathieu

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHPPDO 1.0RC1 released

2008-02-02 Thread Nikolay Ananiev
Hi guys,
I've just released phppdo-1.0RC1. From the readme:

PHPPDO is a database abstraction layer over the current PHP database 
functions,
which aim is to offer a migration path for new applications to the PDO 
classes
presented in PHP 5.1.

Why a migration path?
Currently, most hosting providers offering a shared hosting do not include
support for PDO in their PHP5 enabled web servers. That means most web
developers are stuck with the old database functions and can't migrate to 
PDO.
PHPPDO makes such a migration possible by providing a PDO-like API interface
over the old database functions. After using PHPPDO, a migration to PDO 
afterwards
is a matter of changing a single line of code (this can even be automatic,
when the script detects PDO).

Downloading PHPPDO
http://sourceforge.net/project/showfiles.php?group_id=216242

For more info visit:
http://www.devuni.com/forums/viewforum.php?f=24

Testers needed :) 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHPPDO 1.0RC1 released

2008-02-02 Thread Nikolay Ananiev

"Larry Garfield" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Saturday 02 February 2008, Nikolay Ananiev wrote:
>> Hi guys,
>> I've just released phppdo-1.0RC1. From the readme:
>>
>> PHPPDO is a database abstraction layer over the current PHP database
>> functions,
>> which aim is to offer a migration path for new applications to the PDO
>> classes
>> presented in PHP 5.1.
>>
>> Why a migration path?
>> Currently, most hosting providers offering a shared hosting do not 
>> include
>> support for PDO in their PHP5 enabled web servers. That means most web
>> developers are stuck with the old database functions and can't migrate to
>> PDO.
>
> Do you have a source for that?  Any web host running a stock PHP 5.1 or 
> later
> will have PDO.  They'd have to go to extra effort not to, at which point
> they're not a host worth using.  (The same applies to SPL, PCRE, XML, and 
> a
> bunch of other "optional but default" extension that only a suicidal web 
> host
> would disable.)

I can't give you exact numbers. I'm working for a web development company 
and
many of our clients have shared hosting. Since PHP 5.1 is out, the best I've 
seen is
PDO with SQLite driver and nothing more. The reason
to create PHPPDO is because our framework makes
heavy use of PDO and we need to mimic PDO for hosts that don't have it or
don't have the required driver. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php