Regular Expressions in C#
Posted on 2013-11-12
I have the following string:
I need to find certain matches of that string. Here is what I have tried:
string sPattern = @"DMG\*D8%~NM1\*PR\*2\*%PI\*DNC00~";
The issue is that, for example, the 19481101 could be a different number. I don't care about that, nor do I care about the EDS/MEDICAID. Those parts can change and it's fine. In my pattern above, the parts I don't care about are denoted by a % (I realize its not legal in C# I'm just using it for illustrative purposes). What I'm attempting to do is match up the parts I have that are literal and tell Regex that the parts denoted by % can by anything, I don't care, just ignore them. By the way, this is all inside a text file (I'm looking for one part out of possible thousands of characters).