Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validating using regex not working for UK Postcode could be nuxt issue #546

Open
ahmetskilinc opened this issue May 20, 2022 · 0 comments
Open
Labels
bug report A submitted bug report, not yet validated.

Comments

@ahmetskilinc
Copy link

Regex not working in Nuxt. I've tried to reproduce the issue but the issue isn't to do with the regex or the VueFormulate setup. I think it may be the version of Nuxt that I am using.

I'm using version 2.15.7 but in the docs it shows 2.5.1. Is Nuxt only supported above 2.5.1?

The regex is for a UK Postcode: /^(([gG][iI][rR] {0,}0[aA]{2})|((([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y]?[0-9][0-9]?)|(([a-pr-uwyzA-PR-UWYZ][0-9][a-hjkstuwA-HJKSTUW])|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][abehmnprv-yABEHMNPRV-Y]))){0,}[0-9][abd-hjlnp-uw-zABD-HJLNP-UW-Z]{2}))$/gi

and this is the whole FormulateInput I have:

<FormulateInput
  type="text"
  name="Postcode"
  label="Postcode (required)"
  v-model="postal"
  @keydown.space.prevent
  maxlength="7"
  minlength="5"
  :validation="[
    ['required'],
    ['max', '7', 'length'],
    ['min', '5', 'length'],
    [
      'matches',
      /^(([gG][iI][rR]{0,}0[aA]{2})|((([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y]?[0-9][0-9]?)|(([a-pr-uwyzA-PR-UWYZ][0-9][a-hjkstuwA-HJKSTUW])|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][abehmnprv-yABEHMNPRV-Y]))){0,}[0-9][abd-hjlnp-uw-zABD-HJLNP-UW-Z]{2}))$/gi,
    ],
  ]"
  :validation-messages="{
    required: 'Please enter a valid postcode',
    matches: 'Postcode is not valid.',
  }"
  error-behavior="blur"
/>
@ahmetskilinc ahmetskilinc added the bug report A submitted bug report, not yet validated. label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report A submitted bug report, not yet validated.
Projects
None yet
Development

No branches or pull requests

1 participant