什么是jquery正则表达式来匹配这个字符串“http://path/to/file/file-name-123x123

What is the jquery regex to match "-123x123" in this string "http://path/to/file/file-name-123x123.jpg"

本文关键字:http path file-name-123x123 file to 字符串 正则表达式 jquery 什么      更新时间:2023-09-26

其中文件名可以包含"-123x123"之前的任何数字,"-123x123"中的数字可以是任何数值。

答案是:

-'d+x'd+(?='.jpg)

'd表示"数字"

(?=....)的意思是"跟随"

链接:http://regular-expressions.info