use*_*104 1 regex string integer
string $str = "hello768gonf123";
Run Code Online (Sandbox Code Playgroud)
如何123使用正则表达式获得最后的数字(即)?
如果始终在string(hello768gonf123)的末尾找到整数,则可以使用:
(\d+)$
Run Code Online (Sandbox Code Playgroud)
如果要捕获靠近末尾(123从hello768gonf123foo)的整数,可以使用:
(\d+)\D*$
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
101 次 |
| 最近记录: |