[Rails] Re: regular expression help needed

2009-09-14 Thread Sandip Ransing
Thanks buddies ! I am sure that in next couple of hours, will able to write complex regex ! -- Sandip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

[Rails] Re: regular expression help needed

2009-09-11 Thread Dhruva Sagar
Well for the example string you have given, this does the job : reg = /(.*):\s+(.*)/ s = HYDERABAD/NEW DELHI: Andhra Pradesh chief minister was reg.match(s) location = $1 # = HYDERABAD/NEW DELHI plain_content = $2 # = Andhra Pradesh chief minister was Thanks Regards, Dhruva Sagar.

[Rails] Re: regular expression help needed

2009-09-11 Thread Sandip Ransing
Thanks ! What will be the regular expression to extract *IANS* and *3 September 2009, 02:57pm IST* from following string * IANS 3 September 2009, 02:57pm IST * Sandip -- Ruby on Rails Developer http://sandip.sosblog.com http://funonrails.wordpress.com www.joshsoftware.com

[Rails] Re: regular expression help needed

2009-09-11 Thread Dhruva Sagar
reg = /(.*)\s([0-9]\s.*)/ s = IANS 3 September 2009, 02:57pm IST reg.match(s) location = $1.strip # = IANS plain_content = $2.strip # = 3 September 2009, 02:57pm IST Thanks Regards, Dhruva Sagar. Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html - The trouble with a

[Rails] Re: regular expression help needed

2009-09-11 Thread prashanth hiremath
Hi If i have an file name bangalore.txt if i wanna remove .txt and assign bangalore to temp variable how can it achieve. Regards prashanth On Fri, Sep 11, 2009 at 5:13 PM, Dhruva Sagar dhruva.sa...@gmail.comwrote: reg = /(.*)\s([0-9]\s.*)/ s = IANS 3 September 2009, 02:57pm

[Rails] Re: regular expression help needed

2009-09-11 Thread Abhinav Saxena
1. Go to Google.com 2. Type keywords: Ruby File basename 3. Press I am feeling lucky Thanks, Abhinav -- अभिनव http://twitter.com/abhinav On Fri, Sep 11, 2009 at 5:37 PM, prashanth hiremath prashanthhirema...@gmail.com wrote: Hi If i have an file name bangalore.txt if i

[Rails] Re: regular expression help needed

2009-09-11 Thread Dhruva Sagar
If you need RegExp help this would help you : s = 'Bangalore.txt' regexp = /(.*)\.(/*)/ regexp.match(s) baseName = $1 # = Bangalore But I must say, you should try google a bit more often as Abhinav mentioned. Thanks Regards, Dhruva Sagar. Ted Turner