# Ruby Newbie,Help on String.gsub()

**URL:** <https://www.ruby-forum.com/t/ruby-newbie-help-on-string-gsub/120488>\
**Category:** Rails\
**Created:** [November 17, 2007, 2:39pm UTC](https://www.ruby-forum.com/t/ruby-newbie-help-on-string-gsub/120488 "2007-11-17T14:39:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jagan](https://www.ruby-forum.com/u/jagan)\
**Post date:** [November 17, 2007, 2:39pm UTC](https://www.ruby-forum.com/t/ruby-newbie-help-on-string-gsub/120488/1 "2007-11-17T14:39:22Z")

</div>

Hello All,

May be my question is too easy ,but here is my problem.

I have a certain string which contains “” forward slash  
charachter .I want to replace in my whole string the char “” with  
“/” . I tried a lot but could not achieve

could any body help me in this issue

filename.gsub (/ ‘’ / , “/” )

This is the code i was using ,any help in this regard

Thanks  
Jagan

---

<div class="post-metadata">

**Author:** ![jagan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jagan](https://www.ruby-forum.com/u/jagan)\
**Post date:** [November 17, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/ruby-newbie-help-on-string-gsub/120488/2 "2007-11-17T15:11:33Z")

</div>

You need to escape your backslash by doubling it. Try this:

filename.gsub(’\’,’/’)

* * *

Chris
