How to use the vuelidate/lib/validators/common.regex function in vuelidate

To help you get started, we’ve selected a few vuelidate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gardener / dashboard / frontend / src / utils / validators.js View on Github external
import { minValue } from 'vuelidate/lib/validators'
import includes from 'lodash/includes'
import { parseSize } from '@/utils'

const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const uppercaseAlphaNumPattern = /^[A-Z0-9]+$/
const alphaNumUnderscorePattern = /^\w+$/
const alphaNumUnderscoreHyphenPattern = /^[a-zA-Z0-9-_]+$/
const resourceNamePattern = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/
const consecutiveHyphenPattern = /.?-{2,}.?/
const startEndHyphenPattern = /^-.*.|.*-$/
const numberOrPercentagePattern = /^[\d]+[%]?$/

const base64 = regex('base64', base64Pattern)
const uppercaseAlphaNum = regex('uppercaseAlphaNum', uppercaseAlphaNumPattern)
const alphaNumUnderscore = regex('alphaNumUnderscore', alphaNumUnderscorePattern)
const alphaNumUnderscoreHyphen = regex('alphaNumUnderscoreHyphen', alphaNumUnderscoreHyphenPattern)
const resourceName = regex('resourceName', resourceNamePattern)
const noConsecutiveHyphen = (value) => {
  return !consecutiveHyphenPattern.test(value)
}
const noStartEndHyphen = (value) => {
  return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
  return numberOrPercentagePattern.test(value)
}

const unique = key => withParams({ type: 'unique', key },
  function (value, parentVm) {
    const keys = ref(key, this, parentVm)
    return !includes(keys, value)
github gardener / dashboard / frontend / src / utils / validators.js View on Github external
import includes from 'lodash/includes'
import { parseSize } from '@/utils'

const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const uppercaseAlphaNumPattern = /^[A-Z0-9]+$/
const alphaNumUnderscorePattern = /^\w+$/
const alphaNumUnderscoreHyphenPattern = /^[a-zA-Z0-9-_]+$/
const resourceNamePattern = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/
const consecutiveHyphenPattern = /.?-{2,}.?/
const startEndHyphenPattern = /^-.*.|.*-$/
const numberOrPercentagePattern = /^[\d]+[%]?$/

const base64 = regex('base64', base64Pattern)
const uppercaseAlphaNum = regex('uppercaseAlphaNum', uppercaseAlphaNumPattern)
const alphaNumUnderscore = regex('alphaNumUnderscore', alphaNumUnderscorePattern)
const alphaNumUnderscoreHyphen = regex('alphaNumUnderscoreHyphen', alphaNumUnderscoreHyphenPattern)
const resourceName = regex('resourceName', resourceNamePattern)
const noConsecutiveHyphen = (value) => {
  return !consecutiveHyphenPattern.test(value)
}
const noStartEndHyphen = (value) => {
  return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
  return numberOrPercentagePattern.test(value)
}

const unique = key => withParams({ type: 'unique', key },
  function (value, parentVm) {
    const keys = ref(key, this, parentVm)
    return !includes(keys, value)
  }
github gardener / dashboard / frontend / src / utils / validators.js View on Github external
import { parseSize } from '@/utils'

const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const uppercaseAlphaNumPattern = /^[A-Z0-9]+$/
const alphaNumUnderscorePattern = /^\w+$/
const alphaNumUnderscoreHyphenPattern = /^[a-zA-Z0-9-_]+$/
const resourceNamePattern = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/
const consecutiveHyphenPattern = /.?-{2,}.?/
const startEndHyphenPattern = /^-.*.|.*-$/
const numberOrPercentagePattern = /^[\d]+[%]?$/

const base64 = regex('base64', base64Pattern)
const uppercaseAlphaNum = regex('uppercaseAlphaNum', uppercaseAlphaNumPattern)
const alphaNumUnderscore = regex('alphaNumUnderscore', alphaNumUnderscorePattern)
const alphaNumUnderscoreHyphen = regex('alphaNumUnderscoreHyphen', alphaNumUnderscoreHyphenPattern)
const resourceName = regex('resourceName', resourceNamePattern)
const noConsecutiveHyphen = (value) => {
  return !consecutiveHyphenPattern.test(value)
}
const noStartEndHyphen = (value) => {
  return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
  return numberOrPercentagePattern.test(value)
}

const unique = key => withParams({ type: 'unique', key },
  function (value, parentVm) {
    const keys = ref(key, this, parentVm)
    return !includes(keys, value)
  }
)
github gardener / dashboard / frontend / src / utils / validators.js View on Github external
import { withParams, regex, ref } from 'vuelidate/lib/validators/common'
import { minValue } from 'vuelidate/lib/validators'
import includes from 'lodash/includes'
import { parseSize } from '@/utils'

const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const uppercaseAlphaNumPattern = /^[A-Z0-9]+$/
const alphaNumUnderscorePattern = /^\w+$/
const alphaNumUnderscoreHyphenPattern = /^[a-zA-Z0-9-_]+$/
const resourceNamePattern = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/
const consecutiveHyphenPattern = /.?-{2,}.?/
const startEndHyphenPattern = /^-.*.|.*-$/
const numberOrPercentagePattern = /^[\d]+[%]?$/

const base64 = regex('base64', base64Pattern)
const uppercaseAlphaNum = regex('uppercaseAlphaNum', uppercaseAlphaNumPattern)
const alphaNumUnderscore = regex('alphaNumUnderscore', alphaNumUnderscorePattern)
const alphaNumUnderscoreHyphen = regex('alphaNumUnderscoreHyphen', alphaNumUnderscoreHyphenPattern)
const resourceName = regex('resourceName', resourceNamePattern)
const noConsecutiveHyphen = (value) => {
  return !consecutiveHyphenPattern.test(value)
}
const noStartEndHyphen = (value) => {
  return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
  return numberOrPercentagePattern.test(value)
}

const unique = key => withParams({ type: 'unique', key },
  function (value, parentVm) {
github gardener / dashboard / frontend / src / utils / validators.js View on Github external
import { withParams, regex, ref } from 'vuelidate/lib/validators/common'
import { minValue } from 'vuelidate/lib/validators'
import includes from 'lodash/includes'
import { parseSize } from '@/utils'

const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const uppercaseAlphaNumPattern = /^[A-Z0-9]+$/
const alphaNumUnderscorePattern = /^\w+$/
const alphaNumUnderscoreHyphenPattern = /^[a-zA-Z0-9-_]+$/
const resourceNamePattern = /^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?$/
const consecutiveHyphenPattern = /.?-{2,}.?/
const startEndHyphenPattern = /^-.*.|.*-$/
const numberOrPercentagePattern = /^[\d]+[%]?$/

const base64 = regex('base64', base64Pattern)
const uppercaseAlphaNum = regex('uppercaseAlphaNum', uppercaseAlphaNumPattern)
const alphaNumUnderscore = regex('alphaNumUnderscore', alphaNumUnderscorePattern)
const alphaNumUnderscoreHyphen = regex('alphaNumUnderscoreHyphen', alphaNumUnderscoreHyphenPattern)
const resourceName = regex('resourceName', resourceNamePattern)
const noConsecutiveHyphen = (value) => {
  return !consecutiveHyphenPattern.test(value)
}
const noStartEndHyphen = (value) => {
  return !startEndHyphenPattern.test(value)
}
const numberOrPercentage = (value) => {
  return numberOrPercentagePattern.test(value)
}

const unique = key => withParams({ type: 'unique', key },
  function (value, parentVm) {
    const keys = ref(key, this, parentVm)
github andycrockett / vuex-forms / src / validators / alphaDash.js View on Github external
import {regex} from 'vuelidate/lib/validators/common'

export default regex('alphaDash', /^[a-zA-Z0-9_-]*$/)