This topic is locked
[SOLVED]

 variables in regex - add page on load javascript

5/22/2011 12:38:31 AM
PHPRunner General questions
R
roadyx author

Hi,

How does one stuff a variable in regex: as in:
nlength = 26;

ctrlAccntno.addValidation({

regex: "[0-9]{nlength}",

message: "The field should be numeric with nlength digits",

messagetype: "Text"

.....

Sergey Kornilov admin 5/22/2011

Try something like this:

nlength = 26;

ctrlAccntno.addValidation({

regex: "[0-9]{"+nlength"+}",

message: "The field should be numeric with "+nlength+" digits",

messagetype: "Text"
R
roadyx author 5/24/2011



Try something like this:

nlength = 26;

ctrlAccntno.addValidation({

regex: "[0-9]{"+nlength"+}",

message: "The field should be numeric with "+nlength+" digits",

messagetype: "Text"



Thanks admin. minor correction regex: "[0-9]{"+nlength+"}",