Validation bugfix (unescaped .), improved comments
This commit is contained in:
parent
02a710e15a
commit
026daba3e0
|
@ -1,4 +1,4 @@
|
|||
const ipRegex = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
||||
const ipRegex = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
||||
const cidrNotationRegex = '([0-9]|1[0-9]|2[0-9]|3[0-2])'
|
||||
const hostnameRegex = '^([A-Za-z0-9]*[A-Za-z]+[A-Za-z0-9]*.?)*([A-Za-z0-9]*[A-Za-z]+[A-Za-z0-9]*)$'
|
||||
|
||||
|
@ -9,10 +9,10 @@ export const formValidationFormats = {
|
|||
|
||||
function buildIpRangeRegex(){
|
||||
return new RegExp([
|
||||
'^'+ipRegex+'$|', // Single IP
|
||||
'^'+ipRegex+'-'+ipRegex+'$|', // IP range IP-IP
|
||||
'^'+ipRegex+'$|', // Single: IP
|
||||
'^'+ipRegex+'-'+ipRegex+'$|', // IP range: IP-IP
|
||||
'^'+ipRegex+'/'+cidrNotationRegex+'$|', // IP range with cidr notation: IP/cidr
|
||||
hostnameRegex, // IP range with cidr notation: IP/cidr
|
||||
hostnameRegex, // Hostname: target.tg
|
||||
].join(''))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue