c# - whitch Regex can i use to split XML string before and after mathml match -


i ask regex can use in order splits text string <math xmlns='http://www.w3.org/1998/math/mathml'>....</math>

the result be:

enter image description here

the code is:

        var text = @"{(test&<math xmlns='http://www.w3.org/1998/math/mathml'><apply><plus></plus><cn>1</cn><cn>2</cn></apply></math>)|(<math xmlns='http://www.w3.org/1998/math/mathml'><apply><root></root><degree><ci>m</ci></degree><ci>m</ci></apply></math>&nnm)&<math xmlns='http://www.w3.org/1998/math/mathml'><apply><power></power><cn>1</cn><cn>2</cn></apply></math>#<math xmlns='http://www.w3.org/1998/math/mathml'><set><ci>l</ci></set></math>}";         string findtagstring = "(<math.*?>)|(.+?(?=<math/>))";         regex findtag = new regex(findtagstring);         list<string> textlist = findtag.split(text).tolist(); 

i have found similar question @ using regex split xml string before , after match , ask advice regex expression

thank

ori

after tests, think work:

string findtagstring = "(<math.*?></math>)|((.*){}()#&(.*))</math>"; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -