I want to get a word with a space in the beginning but without a space in the output using ?:
CodePudding user response:
Instead of the non-capturing group (?:), you can use the "match prefix but exclude" group (?<=).
let g = /(?<=\s)j\w /i;
console.log("Here is John".match(g));

