Closed
Description
Environment
nuxt@3.12.3
vue@3.5.13
@vueform/nuxt@1.7.0
vueform@1.11.0
Reproduction
https://stackblitz.com/edit/github-l6wiwpjl?file=src%2FApp.vue
Describe the bug
'/i' flag in regex validation rule seems to do nothing. As seen in the Stackblitz, entering lowercase 'gnd' in the first TextElement should pass validation, as /i flag is set in regex.
To confirm, the same regex passes on regex101
https://regex101.com/r/Aeyzt1/1
This is especially bizarre, as the /i flag is even showcased in Vueform doc for regex patterns
https://vueform.com/docs/validating-elements#rule-regex
Additional context
seems like the problem lies in the .replace of src/services/validation/rules/regex.js
Executing this
var regex = new RegExp('/^GND$/i'.replace(/^\/|\/[^\/]*$/g, ''));
console.log(regex, regex.test('gnd'));
results in this print: /^GND$/ false
the /i flag is removed by the replacement regex