2

I have this string:

var string = "this is test
               1. this is test
               2. this is test
               3. this is test
              this is test
               1. this test   
               2. this is test
              this is test";

Also I have this regex:

var match = /^[\s\S]*(?:^|\r?\n)\s*(\d+)(?![\s\S]*(\r?\n){2})/m.exec(string);

So match[1] is 2. Now I need to increase that result. (I want 3). How can I do that?


That regext matches 2. In other word:

alert(match[1]); //=> 2

Now I need to increase that number. I mean is I want something like:

match[1]++; //=> I want: 3

How can I do that?

stack
  • 10,280
  • 19
  • 65
  • 117

0 Answers0