p 'google.translate(en, fr) this is a test'.match(/^(.+)(\((.*)\)) ?(.*)$/)# I want to make the parenthesis part optional, what's happening?p 'google.translate(en, fr) this is a test'.match(/^(.+)(\((.*)\))? ?(.*)$/)
Standard input is empty
#<MatchData "google.translate(en, fr) this is a test" 1:"google.translate" 2:"(en, fr)" 3:"en, fr" 4:"this is a test"> #<MatchData "google.translate(en, fr) this is a test" 1:"google.translate(en, fr) this is a test" 2:nil 3:nil 4:"">
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!