From: "Jesús Gabriel y Galán" Date: 2010-06-23T00:40:48+09:00 Subject: Re: Extract value On Tue, Jun 22, 2010 at 5:36 PM, Manuel Manu00 wrote: > Hello > > I would like to parse or regexp the following string : > > > > in order to keep only this : pub-9423056098431875 (and store it in a > base) > > I tried with regexp : ((google_ad_client = \"pub-)(.*?)(\";)) > > but it's not working. and i don't know which function to use (split ? > splice ?) and how to proceed... I'm n00b in Ruby, sorry. Try this: irb(main):001:0> doc =< irb(main):003:0" google_ad_client = "pub-9423056098431875"; irb(main):004:0" /* 300x250, created 6/10/09 */ irb(main):005:0" google_ad_slot = "1755518182"; irb(main):006:0" google_ad_width = 300; irb(main):007:0" google_ad_height = 250; irb(main):008:0" irb(main):009:0" EOF => "\n" irb(main):011:0> m = doc.match /google_ad_client = "(.*?)"/ => # irb(main):012:0> m.captures => ["pub-9423056098431875"] Jesus.