Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用于在jquery.tablesorter.js数字字段中拨号的正则表达式_Javascript_Jquery_Regex - Fatal编程技术网

Javascript 用于在jquery.tablesorter.js数字字段中拨号的正则表达式

Javascript 用于在jquery.tablesorter.js数字字段中拨号的正则表达式,javascript,jquery,regex,Javascript,Jquery,Regex,我在jquery.tablesorter.js中添加了一个解析器: $.tablesorter.addParser({ etc... 但我需要对一些数字进行排序,我的正则表达式几乎是无用的: 40.01.02.31 40.01.02.31.01 40.01.02.32 数字最多可以有8个“八位字节”,因此最小值为: xx.xx.xx.xx xx.xx.xx.xx.xx.xx.xx.xx 最大值为: xx.xx.xx.xx xx.xx.xx.xx.xx.xx.xx.xx 我该怎么做?我

我在jquery.tablesorter.js中添加了一个解析器:

$.tablesorter.addParser({ etc...
但我需要对一些数字进行排序,我的正则表达式几乎是无用的:

40.01.02.31
40.01.02.31.01
40.01.02.32
数字最多可以有8个“八位字节”,因此最小值为:

xx.xx.xx.xx
xx.xx.xx.xx.xx.xx.xx.xx
最大值为:

xx.xx.xx.xx
xx.xx.xx.xx.xx.xx.xx.xx
我该怎么做?我试着使用非常好的正则表达式生成器,但它不太适合

有人能插嘴无情地纠正我吗

:)


谢谢大家!

可以使用以下正则表达式:

/^\d+(?:\.\d+){3,7}$/

谢谢你的帮助,不完全是-我做了一把小提琴:上面,它看起来更像我说的最小4个八位组,最大8个。“这些数字最多可以有8个“八位字节”,并且regex匹配的最小值为4,最大值为8,请参见现在的情况,因为代码略有不同;非常感谢你!tablesorter.js仍然没有“完全”正确地对它们进行排序,但至少我现在已经开始运行了,再次感谢您的毅力和技巧——尽管像疯子一样在谷歌上搜索,regex101肯定会在结果中处于首位。。。