surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.12k stars 802 forks source link

RegEx Validation doesn't display a validation error based on the specified regular expression #8076

Closed JaneSjs closed 5 months ago

JaneSjs commented 5 months ago

T17595 - Integer validators not always being used https://surveyjs.answerdesk.io/internal/ticket/details/T17595


The following regex: ^\d+$ allows only integers. It works when you check the value in JavaScript: View Demo.

However, if you setup SurveyJS RegEx validation and enter e, no validation error occurs.

andrewtelnov commented 5 months ago

@JaneSjs Here is the updated example. We don't need validator for numeric type, since the question returns numeric. "e" or "3e" will return undefined. "2e2" will return 200. The \\d+ works for input type text. It should be \\d not \d.

Thank you, Andrew