From: Martin Honnen on
Gary Wardell wrote:

> Given the regex ^(.+)\@(.+?)$ I'm wondering if a really need the "gi",
> since it's matching the whole string and it doesn't really care about case?
>
> Is "new" the preferred way to create regex objects or is it just better in
> this case?

No, you can use regular expression literals but you need to be aware of
the consequences. In your sample you could drop the g flag and also, as
already suggested, use the test method instead of the exec method.


--

Martin Honnen
http://JavaScript.FAQTs.com/
From: Gary Wardell on
Hi,

Yes, I came across that in looking for why it wasn't working.

However, exec returns the captured strings in an array and I need to have
the account separated from the domain name.

I left that out to simplify the sample code.

It's working now.

Thanks,

Gary