'Mr. Mike Smith'.replace(/mr\.\s+/i, ''); // => 'Mike Smith' - kangax
On May 6, 11:46 am, Chris <[EMAIL PROTECTED]> wrote: > I'm importing rows and want to edit names as I parse each row. > > Essentially I would like to do: > "Mr. Mike Smith" -> "Mike Smith" > > when I use: row[0].delete "Mr" > > The string becomes "ike Smith" for some reason. > > I've tried decoding the whole regex thing with things like "/Mr/" but > that's not working either. > > Can anyone help? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
