Answers for "blood group regex"

1

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))
Posted by: Guest on July-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language