Regular Expression | REGEX For ICD9 Codes
I am using Python to extract ICD9 codes. And am using the below regular expression icdRegex = recomp('V\d{2}\.\d{1,2}|\d{3}\.\d{1,2}|E\d{3}\.\d') It captures pattern similar to 13
Solution 1:
Add a negative lookahead assertion like the follwing:
(V\d{2}\.\d{1,2}|\d{3}\.\d{1,2}|E\d{3}\.\d)\b(?!\s?(?:lb|kg)s?)
Solution 2:
Here is HamZa's expression for everyone:
icdRegex = recomp("\b(?:V\d{2}\.\d{1,2}|\d{3}\.\d{1,2}|E\d{3}\.\d)\b(?!\s*(?:kg|lb)s?\b)")
Thanks HamZa & Chapelo for helping out. Appreciate it.
Post a Comment for "Regular Expression | REGEX For ICD9 Codes"