I have a web service that I'm calling that returns a list of error messages. I'm then doing a foreach over this list, and matching based on the text of the error messages in a config file. However, some of the error messages returned from the web service contains some unknown data, such as a date, or a number.
How can I match this text, using C#? Would I have to split the string and try to match each individual word? How do I deal with an unknown variable such as a date or number when doing a ".Contains(...)"?
Here's an example:
Web service list might contain the following
"This is an example static error message"
"Another example static error message"
"This is an error message for employee 2"
"This is an error message dated 11/2/2017"
"Employee 3 does not work here anymore"
In my config file, I have the following:
<add errorText="This is an example static error message" field="N/A" />
<add errorText="Another example static error message" field="N/A" />
<add errorText="This is another example for employee **X**" field="N/A" />
<add errorText="This is an error message dated **X**" field="N/A" />
<add errorText="Employee **X** does not work here anymore" field="N/A" />