Regex to validate email in tabulator4.8 is not working

Viewed 40

In tabulator 4.8

regex:/^[A-Za-z._]{1,}@[A-Za-z]{1,}[.]{1}[A-Za-z.]{2,6}$/

If i use this regex in chrome console. console.log(/^[A-Za-z._]{1,}@[A-Za-z]{1,}[.]{1}[A-Za-z.]{2,6}$/.test("nayaz@nayaz.com"));

it returns true which is correct.

if i pass this same rejex to tabulator

{ title: "EMAIL_ADDRESS", field: "EMAIL_ADDRESS", hozAlign: "center", width: 148, editor: "input", editable: true, headerFilter: "input", validator: ["required","regex:/^[A-Za-z._]{1,}@[A-Za-z]{1,}[.]{1}[A-Za-z.]{2,6}$/"] },

for that same email it throws error, help me in this.

1 Answers

Pass Your Regex as

{
    title: "EMAIL_ADDRESS",
    field: "EMAIL_ADDRESS",
    hozAlign: "center",
    width: 148,
    editor: "input",
    editable: true,
    headerFilter: "input",
    validator: [
      "required",
      "regex:^[A-Za-z._]{1,}@[A-Za-z]{1,}[.]{1}[A-Za-z.]{2,6}$"
    ]
}
Related