AndroidAL
AndroidAL

Reputation: 1119

Rewrite Regex to to be used in comparing?

How can i rewrite this regex?

var exp = /(070|071|072|073|074|075|076|077|078|079)\d{7,8}$/;

can i do this;

var exp[] = {070,071,072,073,074,075,076,077,078,079};

Upvotes: 2

Views: 37

Answers (1)

ssube
ssube

Reputation: 48277

The simplest change would be to use:

var exp = /(07\d)\d{7,8}$/;

instead of listing out each of the ten consecutive digits.

Upvotes: 3

Related Questions