0

I'm using Notepad++ v6.9.2. I need to find ICD9 Codes which will take the following forms:

  • (X##.), (X##.#) or (X##.##) where X is a letter and always at the beginning and # is a number
  • (##.), (##.#), (##.##), (###.), (###.#), (###.##) or (###.###) where # is a number

and

replace the first ( with | and the ) and single space behind second with |.

EXAMPLE

(305.11) TOBACCO ABUSE-CONTINUOUS

Becomes:

|305.11|TOBACCO ABUSE-CONTINUOUS

OTHER CONSIDERATIONS:

There are other places with parentheses but will only contain letters. Those do not need to be changed. Some examples:

UE (Major) Amputation
(282.45) THALASSEMIA (ALPHA)
(284.87) RED CELL APLASIA (W/THYMOMA)
Pain (non-headache) (338.3) Neoplasm related pain (acute) (chronic)

Becomes

UE (Major) Amputation
|282.45|THALASSEMIA (ALPHA)
|284.87|RED CELL APLASIA (W/THYMOMA)
Pain (non-headache) |338.3|Neoplasm related pain (acute) (chronic)
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
G83
  • 89
  • 1
  • 7

1 Answers1

0

You can use a regex like this to match ICD9 codes:

[EV]\d+\.?\d*

This covers both E and V codes and cases where the . is omitted (in my experience this is not uncommon). Use this regex to match the portions of text you need:

\(([EV]?\d+\.?\d*)\)\s?

The outer parentheses are escaped to match literal ( and ) characters, and the inner parentheses create a group for replacement (\1). The \s? at end will capture an optional space after the parentheses.

So your Notepad++ replace window should look like this:

Notepad++ replace

p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
  • This works perfectly. Thank you for answer and lesson on regex. – G83 Aug 04 '16 at 17:46
  • Additionally, after file transformation in Notepad++ I imported the text file into excel. To force the ICD9 codes to be text instead of numeric which loses information I changed the replace statement to: |'\1\ – G83 Aug 04 '16 at 18:18