I am trying to read regex from app.config file
if I try to read strings it is working fine but, if I try to get the regex Pattern it is not accepting my pattern
Here my code is
<appSettings>
<add key="regex" value=@"^(?<TicketNum>\w{3}-\d+)\s+(?<Message>.+?)$"></add>
<add key="getString" value="siva"/>;
</appSettings>
Am I missed anything?
You need to escape <
and >
in your xml, try this:
<appSettings>
<add key="regex" value="^(?<TicketNum>\w{3}-\d+)\s+(?<Message>.+?)$"/>
</appSettings>
Escaping XML Data. Here:
Also no need for the @
sign.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With