| View previous topic :: View next topic |
| Author |
Message |
mvsr
Joined: 07 Oct 2008 Posts: 22
|
Posted: Fri Oct 10, 2008 4:16 am Post subject: how can i remove [ and ] from a string? |
|
|
Hi everybody,
I know that i can use gsub but the problem is that gsub use [ and ] as limiter for a list of chars..
Thanks,
mvsr |
|
| Back to top |
|
 |
vijay
Joined: 08 May 2008 Posts: 63
|
Posted: Fri Oct 10, 2008 4:30 am Post subject: how can i remove [ and ] from a string? |
|
|
Hi mvsr,
it is very simple, escape them with backslashes:
Code :
"[test]".gsub(/\[/,"").gsub(/\]/,"") |
|
| Back to top |
|
 |
|