☑ Regular Expressions not working

 var regExpChipValue   = new RegExp( "entityChip_\d+([A-Za-z]+)" );
 var regExpChipAmount  = new RegExp( "entityChip_(\d+)[A-Za-z]+" );
 

 var strDenomination2 = regExpChipValue.exec( "entityChip_1Satoshi" );
// strDenomination2 == null
 var strDenomination3 = regExpChipAmount.exec( "entityChip_1Satoshi" );
// strDenomination3 == null

this regex works on online regex validators like http://www.regular-expressions.info/javascriptexample.html and https://regex101.com/ what am I doing wrong? Thanx in advance !

You are missing extra \ to escape the \, so it shall be:

new RegExp("entityChip_\\d+([A-Za-z]+)");
1 Like