I have a long list of defined cities which I use in various projects.
I need to integrate it into a regex. Why does this not work?
var text = "It's nice in Amsterdam";
var cities = "(Berlin|Athens|Amsterdam|Buenos Aires|endless|list|from|extra|file)";
var cityRx = new RegExp("/.+ " + cities + "$/", "i");
var city = text.match( cityRx );
$("body").append( "Where ist nice? " + city + "!" );