Friday 15 February 2013

c# - How to match all letters in Regex? -



c# - How to match all letters in Regex? -

im have helper wich mask strings , save xml on request/response logger. working ok when testing in enviroment, when other clients start test have issues because of namespace of xml. heres regex:

formatedstring = regex.replace( formatedstring , "<c.heresmystring>[0-14]+([0-14]{8})</c.heresmystring>" , "<c.heresmystring>****************$1</c.heresmystring>" , regexoptions.ignorecase );

the problem if clients alter namespace of tag alter too. instead of <c.heresmystring> , </c.heresmystring> need match eveything. <**heresmystring> , </**heresmystring>.

edit: examples worked. want replace content of xml tag, part [0-14]+([0-14]{8}). tag part want maintain same original string, , not substitute namespace.

how can that?

i think want this,

formatedstring = regex.replace( formatedstring , "<[^<>]*heresmystring>[0-14]+([0-14]{8})</[^\/]*heresmystring>" , "<c.heresmystring>****************$1</b.heresmystring>" , regexoptions.ignorecase );

c# regex

No comments:

Post a Comment