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 <http://www.brainyquote.com/quotes/authors/t/ted_turner.html>  -
"Sports is like a war without the killing."

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 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.com>wrote:
>
>> 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 kitten is that when it grows up, it's always a cat."
>>
>> On Fri, Sep 11, 2009 at 4:28 PM, Sandip Ransing <san2...@gmail.com>wrote:
>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to