Filter A Part Of An Url That Goes Like Image-123-123 Regex
I need to get the generated size of an image in wordpress using Javascript, the url looks like this: wp-content/uploads/2018/04/image-300x200.jpg and i need to get only the value
Solution 1:
Solution 2:
use this:
/(\d+?x\d+?)\./
according to format NumbersxNumbers.
console.log('wp-content/uploads/2018/04/image-300x200.jpg'.match(/(\d+?x\d+?)\./)[1])
Post a Comment for "Filter A Part Of An Url That Goes Like Image-123-123 Regex"