From: Shashank Date Date: 2002-11-14T16:19:12+09:00 Subject: Re: regex help Answering my own post .. should have tried harder b4 posting. m = /\'.*\'\'.*?\'/.match(%Q{This is a 'single ''quoted'' string' with 'two' matches}) puts m[0] Sorry for the noise ! "Shashank Date" wrote in message news:qmHA9.17372$jj5.440511@twister.rdc-kc.rr.com... > Using ruby 1.7.3 (2002-10-12) [i386-mswin32] on Win XP (Home) > > Trying to creat a regex which will match a single-quoted string. > My first attempt 'almost' works: /\'.*?\'/ > > But then I also want it to match single-quoted strings which have embedded > single quotes. > To embed, you can escape a single quote by putting another single quote just > before it. > For example : > > m = /\'.*?\'/.match(%Q{This is a 'single ''quoted'' string' with only one > match}) > puts m[0] # ^ ^ > # These are two single quotes and not a > double quote > > > I want this to print: 'single ''quoted'' string' . > But I am getting: 'single ' > > Please help. > TIA > > -- shanko > > >