blood group regex

Solutions on MaxInterview for blood group regex by the best coders in the world

showing results for - "blood group regex"
Jan
31 Sep 2017
1const validBloodGroupRegex = /^(A|B|AB|O)[+-]$/i; // Here i is to ignore case sensitivity
2const validBloodGroupString = 'AB+';
3const invalidBloodGroupString = 'BC+';
4
5// Returns true
6console.log(validBloodGroupRegex.test(validBloodGroupString))
7
8// Returns false
9console.log(validBloodGroupRegex.test(invalidBloodGroupString))