所以我知道min()可以从数组中获得最低值,但是我需要数组中的3个最低值.
假设我的数组命名为$myArray:
我asort($myArray)在我的阵列上使用,然后print_r($myArray)输出:
Array (
[137] => 4.90416668118
[135] => 7.1203544474
[18] => 7.2476262434
[81] => 8.37903400152
[33] => 9.1074567001
[4] => 9.90788482793
[138] => 10.2493339987
[5] => 11.6024401676
[63]...and so on until
[124] => 8727.73285117
[153] => 8727.73285117
[117] => 8727.73285117
)
Run Code Online (Sandbox Code Playgroud)
如何才能获得3个第一个值或X个第一个值...
我应该指明:丢失钥匙是否可以做到这一点?
我需要在Javascript中使用RegEx模式,该模式将包含.html以及以字符串结尾的所有文件名rgo1.
我还需要Javascript中的RegEx模式,它将排除所有.html以及包含字符串的文件名rgo1.
这是webpack.config中的文件名匹配,这就是我想要这个模式的原因.
谢谢你的"包含"模式,我找到了一个有效的模式,我现在会在我的"不包含模式"中粘贴失败的尝试:
[^rgo1].*\.html$/gm // nope
(?!^rgo1$).*\.html$ // nope
^((?!rgo1).)*$.*\.html$ // nope
^((?!rgo1).)*.\.html$ //works...paste this in your answer for the win
Run Code Online (Sandbox Code Playgroud)