[Bostonphptalk] long reg exs in javascript

Joshua Johnston johnston.joshua at gmail.com
Tue Feb 3 20:45:01 EST 2009


On Tue, Feb 3, 2009 at 8:38 PM, Joshua Johnston
<johnston.joshua at gmail.com> wrote:

> IIRC you can do something like

>

> var pattern = 'xxxx|xxxx|xx';

>

> pattern += 'xxx|xxxxxx|xxx';

>

> var regex = new RegExp(pattern);

>


EDIT: You have to put the / in your string also like "/pattern/modifier"



>

> the // syntax just instances a new RegExp instance

>

> On Tue, Feb 3, 2009 at 8:19 PM, Kenneth Downs <ken at secdat.com> wrote:

>> Is there a way to build regexp's as strings in javascript?

>>

>> list = 'xxxxxx|xxx|xx| and on an on...

>>

>> list2 = 'xxx|xxx|' and on and on

>>

>> regexp = '/ ?put my string in here somethow?

>>

>> --

>> Kenneth Downs

>> Secure Data Software, Inc.

>> www.secdat.com www.andromeda-project.org

>> 631-689-7200 Fax: 631-689-0527

>> cell: 631-379-0010

>>

>> _______________________________________________

>> Bostonphptalk mailing list

>> Bostonphptalk at bostonphp.org

>> http://seven.pairlist.net/mailman/listinfo/bostonphptalk

>>

>



More information about the Bostonphptalk mailing list