user357034 user357034 - 4 months ago 12
Javascript Question

get all characters after "," character

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 :)

Edit: a javascript answer would be just as good

Answer

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 //