Dr.Ruud wrote:
scooter schreef:

Can someone help me with the regexp that will match exactly two
quotes(') or no quotes in the string.
If a single quote exists, then will break out.

eg:
aabbcc -  Should Match
aa''bb''c''c - Should Match
a''b - Should Match
ab'' - Should Match


aa'bbcc - Should not Match
aa''bb'cc - Should not Match (since there is a single quote)
'aabcc - Should not Match

Why use a regex?
You can just test the evenness of the quotescount, see `perldoc -f tr`.

A regex-way:

   m/\A(?:[^']*'[^']*')*[^']*\z/

The OP's examples fit this interpretation, but I assumed him to mean
that "aa'bb'cc" would fail the match. We need to find out :)

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to