Hi,
I want to replace all the special characters in my string except ‘&’
with ‘-’. How do i do that?
I am currently using
gsub(/[^[:alnum:]]/,’-’)
But how do i say except ‘&’?
Please suggest.
Regards,
Hi,
I want to replace all the special characters in my string except ‘&’
with ‘-’. How do i do that?
I am currently using
gsub(/[^[:alnum:]]/,’-’)
But how do i say except ‘&’?
Please suggest.
Regards,
Try:
gsub(/[^[:alnum:]&]/,'-')
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs