in reply to Perl Matching

Maybe it helps if you rephrase your problem?

Check whether a string contains characters that are not a quotation mark, then a single quotation mark, and then only characters that are not a quotation mark

If you look at your problem that way, you should convince yourself that it is equivalent to "string contains exactly one quotation mark", and it should also be fairly easy to translate that to a regular expression.

Replies are listed 'Best First'.
Re^2: Perl Matching
by RMGir (Prior) on Oct 24, 2013 at 11:40 UTC
    Slight restatement:

    Check whether a string optionally contains characters that are not a quotation mark, then a required single quotation mark, and then, optionally, only characters that are not a quotation mark

    But yes, Corion's answer should get you on the right track.


    Mike