I finally got how to parse the string and allow it to start and end
with either a ' or a ". The start and end character must be the same.

($x)=$line=~m/((:(["'])[^\2]*\2)+)/;

(["']) matches the starting " or ' and captures it. The [^\2]* matches
all following characters except to the starting character. The \2
matches the starting character (and might be the ending character)
That entire pattern repeats one or more times to caputure doubled
initial ' or " characters within the string. If you want to know the
starting character, replace the

($x) with ($x,$delimiter)

On Fri, Jul 5, 2013 at 9:44 AM, Elardus Engelbrecht
<elardus.engelbre...@sita.co.za> wrote:
> John McKown wrote:
>
>>One that always makes me sweat is matching the contents inside ' marks, where 
>>a single ' is encoded as two ' marks next to each other within the outer ' 
>>marks. The same matching contents within parentheses where subparameters 
>>within parentheses are permitted. E.g. 'This isn''t quite right!' or 
>>(a,b,(c,d),e).
>
> Hmmm, now I got a memory check from your nasty remark! Bang! Reboot! ;-D
>
> Curiousity question: years ago I asked that question to a professor, but got 
> no answer.
> Question: Can you replace those two quotes (outer and inner) with something 
> not related to each other and then retry the parse?
>
> Something like this: 'This isn~}t quite right!' just temporarily change for 
> parse.
>
> Alternatively there are two types of quotes:
> '  (single character with single mark)
> "  (single character with double marks)
>
> Can you alternate between them and do your reg parse?
> Like this: "This isn''t quite right!"
>
> (Note: One character left of The. Two characters between N an T. One 
> character next to exclamation character.)
>
> Just curious if you don't mind please.
>
> Groete / Greetings
> Elardus Engelbrecht
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



-- 
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to