如何使用正则表达式获取特定字符后的所有字符,例如逗号(",") [英] How can I use regex to get all the characters after a specific character, e.g. comma (",")
本文介绍了如何使用正则表达式获取特定字符后的所有字符,例如逗号(",")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要正则表达式从变量中获取,
(不包括它)之后的所有字符。这个变量可以包含例如
Need a Regex to get all characters after ,
(not including it) from a variable. This variable can contain for example
'SELECT___100E___7',24
'SELECT___100E___7',1
'SELECT___100E___7',286
'SELECT___100E___7',5147
注意:可以有任意长度的字符在此变量中的,
之后。
Note: There can be any length of characters after the ,
in this variable.
正则表达式的解释对新手来说是一个额外的帮助:)
An explanation of the regexp would be a added help for the novice :)
编辑:一个javascript答案会一样好
a javascript answer would be just as good
推荐答案
你不需要正则表达式来做这件事。这是一个例子:
You don't need regex to do this. Here's an example :
var str = "'SELECT___100E___7',24";
var afterComma = str.substr(str.indexOf(",") + 1); // Contains 24 //
这篇关于如何使用正则表达式获取特定字符后的所有字符,例如逗号(",")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文