Regex Problem

Regex Problem

am 31.07.2009 19:23:07 von Igor Escobar

--0015175cb476750d1f047003acca
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi Folks,
I have a serious problem.

must create a regular expression against all that is between single quote or
double quotes. Easy? Ok, i know, but i need that "everything" must to be too
an single quote or double quote.

If i have this SQL command:

SELECT * FROM TSTRENIC.MEI_ACESSO WHERE UPPER(DS_MEI_ACS) LIKE *'%NOME' ASD
' AS'ASD'%' *AND USUARIO = *'oaksdpokasd'asda'* ORDER BY DS_MEI_ACS ASC;

SELECT * FROM TSTRENIC.MEI_ACESSO WHERE USUARIO_DATA BETWEEN *'2007-01-02'*AND
*'2008-07-08'*

Anyone have any idea?



I need an expression which case the fields in bold.


Regards,
Igor Escobar
Systems Analyst & Interface Designer

+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar (twitter)

--0015175cb476750d1f047003acca--

Re: Regex Problem

am 31.07.2009 21:26:04 von Igor Escobar

--0015175cb47623e5560470056437
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

The solution don't need to be with regex, if anyone can solve this with
other way will be very helpfull .


Regards,
Igor Escobar
Systems Analyst & Interface Designer

+ http://blog.igorescobar.com
+ http://www.igorescobar.com
+ @igorescobar (twitter)





On Fri, Jul 31, 2009 at 2:23 PM, Igor Escobar wrote:

> Hi Folks,
> I have a serious problem.
>
> must create a regular expression against all that is between single quote
> or double quotes. Easy? Ok, i know, but i need that "everything" must to be
> too an single quote or double quote.
>
> If i have this SQL command:
>
> SELECT * FROM TSTRENIC.MEI_ACESSO WHERE UPPER(DS_MEI_ACS) LIKE *'%NOME'
> ASD ' AS'ASD'%' *AND USUARIO = *'oaksdpokasd'asda'* ORDER BY DS_MEI_ACS
> ASC;
>
> SELECT * FROM TSTRENIC.MEI_ACESSO WHERE USUARIO_DATA BETWEEN *'2007-01-02'
> * AND *'2008-07-08'*
>
> Anyone have any idea?
>
>
>
> I need an expression which case the fields in bold.
>
>
> Regards,
> Igor Escobar
> Systems Analyst & Interface Designer
>
> + http://blog.igorescobar.com
> + http://www.igorescobar.com
> + @igorescobar (twitter)
>
>
>
>

--0015175cb47623e5560470056437--

Re: Regex Problem

am 31.07.2009 22:01:59 von Shawn McKenzie

Igor Escobar wrote:
> The solution don't need to be with regex, if anyone can solve this with
> other way will be very helpfull .
>
>
> Regards,
> Igor Escobar
> Systems Analyst & Interface Designer
>
> + http://blog.igorescobar.com
> + http://www.igorescobar.com
> + @igorescobar (twitter)
>
>
>
>
>
> On Fri, Jul 31, 2009 at 2:23 PM, Igor Escobar wrote:
>
>> Hi Folks,
>> I have a serious problem.
>>
>> must create a regular expression against all that is between single quote
>> or double quotes. Easy? Ok, i know, but i need that "everything" must to be
>> too an single quote or double quote.
>>
>> If i have this SQL command:
>>
>> SELECT * FROM TSTRENIC.MEI_ACESSO WHERE UPPER(DS_MEI_ACS) LIKE *'%NOME'
>> ASD ' AS'ASD'%' *AND USUARIO = *'oaksdpokasd'asda'* ORDER BY DS_MEI_ACS
>> ASC;
>>
>> SELECT * FROM TSTRENIC.MEI_ACESSO WHERE USUARIO_DATA BETWEEN *'2007-01-02'
>> * AND *'2008-07-08'*
>>
>> Anyone have any idea?
>>
>>
>>
>> I need an expression which case the fields in bold.
>>
>>
>> Regards,
>> Igor Escobar
>> Systems Analyst & Interface Designer
>>
>> + http://blog.igorescobar.com
>> + http://www.igorescobar.com
>> + @igorescobar (twitter)
>>

Not entirely sure I understand. You want to BOLD the things contained
in quotes and you put the * there to show that? If so, this is not tested:

$bolded = preg_replace('#([\'"])(.*?)\1#', '\1\2\1', $text);

--
Thanks!
-Shawn
http://www.spidean.com

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

Re: Re: Regex Problem

am 31.07.2009 22:15:21 von Shawn McKenzie

Igor Escobar wrote:
> No no, i need to make an regex to "match" the bold areas in my string.
> Anything between single quotes or double quotes (including quotes and
> double quotes). Understand?
>
>
> Regards,
> Igor Escobar
> Systems Analyst & Interface Designer
>
> + http://blog.igorescobar.com
> + http://www.igorescobar.com
> + @igorescobar (twitter)
>
That's not going to happen without some other criteria. There is no way
for the regex engine to guess at which sets of quotes belong inside
another set of quotes.

-Shawn

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

Re: Re: Regex Problem

am 31.07.2009 22:25:35 von Shawn McKenzie

Shawn McKenzie wrote:
> Igor Escobar wrote:
>> No no, i need to make an regex to "match" the bold areas in my string.
>> Anything between single quotes or double quotes (including quotes and
>> double quotes). Understand?
>>
>>
>> Regards,
>> Igor Escobar
>> Systems Analyst & Interface Designer
>>
>> + http://blog.igorescobar.com
>> + http://www.igorescobar.com
>> + @igorescobar (twitter)
>>
> That's not going to happen without some other criteria. There is no way
> for the regex engine to guess at which sets of quotes belong inside
> another set of quotes.
>
> -Shawn

Especially since in one of your examples you don't even have an even
number of quotes.

--
Thanks!
-Shawn
http://www.spidean.com

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