Re: Substituting in a group

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

aquadoll wrote:
) Hello,
) Thanks for all the replies. I was actually trying to get the part of
) $Entry I am interested in, in $TempEntry.
) I used the following 2 lines (as shown in the OP):
) $TempEntry=$Entry
) $TempEntry =~ s/"([A-Za-z\s]*([,][A-Za-z\s]*)+)"/$1/;
) Why did the above did not get "the part of $Entry I am interested in"
) in $TempEntry? What did I do wrong?

It's a substitution.  You substitute the quoted part with the part
between quotes.  The rest remains intact.

To get just the part between quotes, use this:

  my ($TempEntry) = $Entry =~ /"(.*?)"/;

Why the complicated match string by the way ?
Do you only want to match quoted strings that contain a comma ?
It seems needlessly complex.

SaSW, Willem
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !

Site Timeline