I am a newbie in regular expressions. I have a problem with this one. I need to add chars from addons variable as allowed characters to the next regex re.
var addons = '_-';
re = new RegExp(/^[a-zA-Z]+$/i);
console.log('match a', re.test('a'));
console.log('match a_', re.test('a_'));
console.log('no match 9', re.test('9'));
console.log('no match 9_', re.test('9_'));
Any suggestions? Thanks.
addonscharacters only allowed at the end? Or in any position?