0

My original text is (all one line):

var _7question = new Array();
_7question[0] = "question 1";
_7question[1] = "question 2";
_7question[2] = "question 3";
_7question[3] = "question 4";
var _7questionText = new Array();
_7questionText[0] = "ans1"
 _7questionText[1] = " ans2";
_7questionText[2] = " ans3";
_7questionText[3] = "this is the last answer";

And I'm attempting to strip out _7question[0] = "question 1"; through _7question[3] = "question 4"; using a javascript match expression.

The expression I'm attempting to use is:

(/_7question\[.*\] = .*";/g)

However, it seems to also grab the questiontext elements as well which I don't want. I tested this before with each element on its own line and it worked perfectly, but upon setting everything to a single line, the expression no longer works.

TylerH
  • 19,065
  • 49
  • 65
  • 86
Glynbeard
  • 1,347
  • 2
  • 18
  • 31

1 Answers1

0

You can use [0-9]+ to match just numbers.

Edit: It seems you want a non-greedy match on your .*s.

_7question\[.*?\] = .*?;
Community
  • 1
  • 1
Michael Tang
  • 4,076
  • 2
  • 22
  • 24