From: "Abinoam Jr." Date: 2010-12-17T07:37:09+09:00 Subject: Re: xml parsing in ruby (ARGV[0].nil?) ? ("xmlfile.xml") : (ARGV[0]) The first ARGV is nil? The user didn't suplied any command line argument? So use the "xmlfile.xml" as default. Else, use the filename suplied by the user. Try "xml2uppaal.rb xmlfile2.xml". Regexp.new(/\w*_(\w*)/) Search for something in the form of (anyword) + an underline + (anyword) and "save" the word after the underline. "\w*_(\w*)" \w (any word character) * 1 or more times () delimiter for retrieving it after the search. Play around with this site. http://www.rubular.com/ On Thu, Dec 16, 2010 at 3:26 PM, Salim Reza wrote: > Abinoam Jr. wrote in post #968849: >> Salim, >> >> I have "finished" the script. >> It's getting uglier at each interaction. (needs refactoring) >> But, it seems to work well. >> >> I renamed to xml2uppall.rb. >> There's 2 xml. The second is a modified version just for put the >> script to proof. >> Each cpp file corresponds to an xml file. >> >> Tell me if it works for you. >> >> Tell me if you don't understand any part of the code. >> >> Abinoam Jr. > > Hi Abinoam, > > It works as intended. Thanks for the help. I have understood most of the > code. Except: ARGV[0].nil? ? "xmlfile.xml" : ARGV[0] and > Regexp.new(/\w*_(\w*)/). I am trying to take a look about these from > tutorials. > > Thanks once again. > > -- > Posted via http://www.ruby-forum.com/. > >