Regex: replace inner string

Posted by AllenG on Stack Overflow See other posts from Stack Overflow or by AllenG
Published on 2010-03-25T12:50:35Z Indexed on 2010/03/25 12:53 UTC
Read the original article Hit count: 614

Filed under:
|
|

I'm working with X12 EDI Files (Specifialy 835s for those of you in Health Care), and I have a particular vendor who's using a non-HIPAA compliant version (3090, I think). The problem is that in a particular segment (PLB- again, for those who care) they're sending a code which is no longer supported by the HIPAA Standard. I need to locate the specific code, and update it with a corrected code.

I think a Regex would be best for this, but I'm still very new to Regex, and I'm not sure where to begin. My current methodology is to turn the file into an array of strings, find the array that starts with "PLB", break that into an array of strings, find the code, and change it. As you can guess, that's very verbose code for something which should be (I'd think) fairly simple.

Here's a sample of what I'm looking for: ~PLB|1902841224|20100228|49>KC15X078001104|.08~

And here's what I want to change it to: ~PLB|1902841224|20100228|CS>KC15X078001104|.08~

Any suggestions?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex