For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > June 2006 > how preg_match any character except quote?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how preg_match any character except quote?
Yandos

2006-06-24, 8:03 am

Hi all, please correct me if I'm completely off topic here... ;)

I'd like to match any character except ". Been thinking about making a class [.!\"], but it does not work. It
seems that dot [.] does not work in class. Is there a way to match any character in a class except some
few characters? I know that making a class for all characters sounds alogical (that's maybe the reason
why dot does not work), but I don't get any better solution.

Thank you for help,
Y.

--
sorry for any ads below :(

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
Jari Jokinen

2006-06-24, 8:03 am

Yandos <fakemail@fakeisp.com> wrote:

> I'd like to match any character except ".


You can use negation (^) in a character class.

[^"] matches any character except "

--
Jari
Yandos

2006-06-26, 3:59 am

"Jari Jokinen" <jari.jokinen@iki.fi> wrote in news:JnSmg.8583$Vq6.6794@reader1.news.jippii.net:

> Yandos <fakemail@fakeisp.com> wrote:
>
>
> You can use negation (^) in a character class.
>
> [^"] matches any character except "
>


Thank you, it works :)

Y.


--
sorry for any ads below :(

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com