Javascript 比较两个字符串时,忽略这些字符串中间的数字

Javascript 比较两个字符串时,忽略这些字符串中间的数字,javascript,jquery,Javascript,Jquery,我正在比较Jquery中的两个变量值,但这里我需要忽略它们之间的数字。 代码如下: var value1=Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing ; var value2=Earn a score greater than or equal to 6 points for assignment certifictaion Issue Testing ;

我正在比较Jquery中的两个变量值,但这里我需要忽略它们之间的数字。 代码如下:

var value1=Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing ;

var value2=Earn a score greater than or equal to 6 points for assignment certifictaion Issue Testing ;

当使用j query比较两个字符串时,我希望不考虑两个字符串中间的数字而进行比较

为什么不用空格替换所有数字?和后记比较这两个字符串

var value1 = "Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing";
var value2= "Earn a score greater than or equal to 61 points for assignment certifictaion Issue Testing";

var result = value1.replace(/\d/g, "") === value2.replace(/\d/g, "");
alert(result)

为什么不把所有的数字都换成空格呢?和后记比较这两个字符串

var value1 = "Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing";
var value2= "Earn a score greater than or equal to 61 points for assignment certifictaion Issue Testing";

var result = value1.replace(/\d/g, "") === value2.replace(/\d/g, "");
alert(result)

为什么不把所有的数字都换成空格呢?和后记比较这两个字符串

var value1 = "Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing";
var value2= "Earn a score greater than or equal to 61 points for assignment certifictaion Issue Testing";

var result = value1.replace(/\d/g, "") === value2.replace(/\d/g, "");
alert(result)

为什么不把所有的数字都换成空格呢?和后记比较这两个字符串

var value1 = "Earn a score greater than or equal to 3 points for assignment certifictaion Issue Testing";
var value2= "Earn a score greater than or equal to 61 points for assignment certifictaion Issue Testing";

var result = value1.replace(/\d/g, "") === value2.replace(/\d/g, "");
alert(result)

您可以比较两个辅助字符串,其中没有中间的数字(简单的<代码>替换()/代码>调用可以从字符串中删除数字)。Value1.Read(/\D/G,“”)是Value1 SANDENTEX,可以比较两个辅助字符串,而中间没有数字(简单的代码>替换())/Cudio>调用可以从字符串中删除数字。Value1.1.替换(//D/G,“”)是Value1SANS数字,可以比较两个辅助字符串,而中间没有一个数字(简单的<代码>替换()/代码>调用可以从字符串中删除数字)。call可以从字符串中删除数字)。value1.replace(/\d/g,“”)是value1