typescript
const regKey: string = /^google-(.+){10,}-name$/;
const name1: string = "google-15922231201-name";
const name2: string = "google-dbid%3AAACd8VcY240_OYIPqr4L-8M6RvNEDErLG1s-name";
const matches1 = name1.match(regKey);
const matches2 = name2.match(regKey);
在这里,matches1[1],是能够拿到 "15922231201",但是,matches2[1],却拿不到中间的那一长串字符串。返回值是 "s",只有一个 s......
我在 https://regex101.com/ 这里试过,引擎选 javascript,这两字符串,都是符合要求的。
请问一下,这里的 reg 哪里写的不对。
另,我知道可以直接用 substring + 长度,直接拿到 google- & -name 匹配的中间的字符串,但这里,我想了解下,这个正则是哪里写得不对了?