Doing this in javascript.
I have path's like this: /p/BC3eKD-rX-w/
I have a pattern like this: /\\/p\\/([\\w-]+)\\//g
I am trying to extract "BC3eKD-rX-w" but it keeps matching the entire string.
I suck at regular expressions, have spent 2 hours reading and watching videos and am very frustrated.
Help?
var exp = /\/p\/([\w-]+)\//g;
console.log(exp.exec("/p/BC3eKD-rX-w/")[1]);
Works fine with me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.