From: Jagadeesh Date: 2009-07-14T20:35:05+09:00 Subject: Re: a regex that does not contain comma Why cann't you look for , only? like str =~ /,/ You do not need to looks for what other characters are. Thanks On Jul 14, 3:48 pm, Axel Schmalowsky wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > Sebastian Hungerecker wrote: > > Am Dienstag 14 Juli 2009 12:01:23 schrieb Axel Schmalowsky: > >> Trying the regexp /^[^,]*$/ fails with the code below: > >> [...] > >> Am I missing sth? > > > Your code expects the regex to match if the string contains a comma and > not > > match if the string does not contains a comma. That's the opposite of what > > Justin's regex does and also the opposite of what the Sijo asked for. > > Also if the goal had been to have the regex match if there is a comma /,/ > > would have sufficed as a regex. > > Also note that with your regexp your code outputs "string does not > contain a > > comma" for the string ",". > > > HTH, > > Sebastian > > Well, negative logic .. ;-) > > This regexp matches correctly if the string consists only of a comma: > > /(?>(?:\w+\s*)*(?=,))+/ > > - -- > Freundliche Grüße / Kind regards > > Axel Schmalowsky > Platform Engineer > ___________________________________ > > domainfactory GmbH > Oskar-Messter-Str. 33 > 85737 Ismaning > Germany > > Mobil:      +49 (0)176 / 10246727 > Telefon:  +49 (0)89 / 55266-356 > Telefax:  +49 (0)89 / 55266-222 > > E-Mail:   aschmalow...@df.eu > Internet:www.df.eu > > Registergericht: Amtsgericht München > HRB-Nummer 150294, Geschäftsführer: > Tobia Sara Marburg, Jochen Tuchbreiter > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.10 (MingW32) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iEYEARECAAYFAkpcYm8ACgkQsuqpduCyZM1itQCfZDT+img/utF3v72MxZFIcNTO > gTMAn3mf1/4dIyQdqv5XQz16jyD1j3Sr > =rY8S > -----END PGP SIGNATURE-----