【发布时间】:2016-04-27 00:59:50
【问题描述】:
我有一个这样的文本区域:
<textarea>
this is a test [1] also this [2] is a test
and again [3] this is a test
</textarea>
现在我需要获取[] 中的最大数字。在这种情况下,我需要得到3。我该怎么做?
【问题讨论】:
-
获取字符串变量中textarea的值,使用正则表达式提取[]中的值,将它们解析为数字,然后对它们进行排序,得到最大值。
标签: javascript jquery regex