the codes below will print[‘CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC’ ]
let criminals = "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3";
let reCriminals = /c+/gi;
let result = criminals.match(reCriminals)
console.log(result)
the codes below will print : [’ ', ’ ', ‘CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC’, ’ ’ , ’ ’ ]
let criminals = "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3";
let reCriminals = /c*/gi; // Change this line
let result = criminals.match(reCriminals)
console.log(result)
so the difference of those (catch criminal challenge) are:
if we use * character it will print with space, but if we use + character it will not print with space
my question: why with the * character it will print with the space? so that’s why I’m still confused between * character and + character