var s = "3+4=7";
var regex = /=(.+)/; // match '=' and capture everything that follows
var matches = s.match(regex);
if (matches) {
var match = matches[1]; // captured group, in this case, '7'
document.write(match);
}
Run Code Online (Sandbox Code Playgroud)
jsfiddle中的工作示例.
| 归档时间: |
|
| 查看次数: |
9668 次 |
| 最近记录: |