c# - Is there a regular expression for this? -


i have problem finding regular expression. have text, maybe divided xml. example:

<root>   <text>thi</text>   <text>s ju</text>   <text><bold>s</bold></text>   <text>t tes</text>   <text><italic>t</italic></text> </root> 

i want search word "just" in xml , need result

ju</text> <text><bold>s</bold></text> <text>t 

is there posibility result regular expression?

by way: have regular expression plain text xml, (in c#-syntax):

string plaintext = new regex(@"\<[^\<]*\>").replace(xmlstring, string.empty); 

this 1 finds every "<" ">" (*) in between not "<" , replaces string.empty. plain text , search "just", result "just", not xml in between...

does have idea?

better don't use regexp on xml. don't.

according task, after each character of string looking for, can expect xml tags. need insert 'maybetag' regex part after each letter - this:

j(\<[^\<]*?\>\s*)*u(\<[^\<]*?\>\s*)*s(\<[^\<]*?\>\s*)*t(\<[^\<]*?\>\s*)* 

working sample http://www.rexfiddle.net/wdkpliz


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -