Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

blood group regex

const validBloodGroupRegex = /^(A|B|AB|O)[+-]$/i; // Here i is to ignore case sensitivity
const validBloodGroupString = 'AB+';
const invalidBloodGroupString = 'BC+';

// Returns true
console.log(validBloodGroupRegex.test(validBloodGroupString))

// Returns false
console.log(validBloodGroupRegex.test(invalidBloodGroupString))
 
PREVIOUS NEXT
Tagged: #blood #group #regex
ADD COMMENT
Topic
Name
2+9 =