Hi
I am trying to write a regular expression in javascript but I am having a hard time getting it to work.
I am returning data from my c# server that comes back like this:
ggga,12&4,4&ggg,234&
Now there are 2 fileds the name field and the repetitions. each fold these fields is seperated by the comma. Each group is then seperated by the & symbol.
So the results should be
ggga,12
4,4
ggg,234
Then later I want to seperate it further since I will then need each indivdual field(maybe use capturing parenthesis? So I would have one to capture the names and one to capture the repetitions).
Now I written some regular expression in C# so I used a program called "expresso" but it is more for the .net framework. In it I wrote this
([a-z0-9]+),([0-9]+)
My results
ggga,12
4,4
ggg,234
Exactly what I wanted.
But in Javascript I get a different story. I used the same expression and got:
ggga,12
ggga
12
Not what I wanted. So what am I doing wrong?
Thanks
Here is my javascript code:
var strip = /([a-z0-9]+),([0-9]+)/i;
var result = strip.exec(response);
where response contains(ggga,12&4,4&ggg,234&).