Link to home
Start Free TrialLog in
Avatar of MJ
MJFlag for United States of America

asked on

Simple JavaScript Regex Question About Optional String

What changes do I have to make to modify this to match testcreditcard. and creditcard.
if (currHost.match(/(accountopening\.|creditcard\.|web\.oflows\.us|blog\.)/i)) { }

Open in new window

I thought it should it be something like the below but that seems to allow anything infront of creditcard :
if (currHost.match(/(accountopening\.|(test)?creditcard\.|web\.oflows\.us|blog\.)/i)) { }

Open in new window

Thanks!
SOLUTION
Avatar of Jan Louwerens
Jan Louwerens
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MJ

ASKER

Thanks!