I have found a string of HTML that gives me "[title | Example pattern
"dafasdfasdf, adfasd. [Test | adf ddasfasdf [sdf | esg ad]"
I need to change "[title |" With "http://www.test.com/'>Title"
What is the most distant from this point of view?
I was getting close with:
string test = "dafasdfasdf adfasd [test | http: //www.test.com/] adf ddasfasdf [SDAF | Http: //www.madee.com/] esg advertising "; String p18 = @ "(\ [. *. *. *. *? \])"; Matching MC18 = Reggae Matches (Test, P-18, Reggae Option, Sineline Line | Reggaeops, Ignore Case); Foreign currency (match M in MC18) {string value = m.Groups [1]. Value; String fulcag = value. Inclination (value.InxexOf ("["], value length - value.IndexOf ("[")); Console.light line ("text =" + full tag); }
There should be a cleaner way to exclude two values "title" bit and URL only.
Any suggestions?
Change Pattern:
\ [([^ |] + ) \ | With a brief description: \ # # character '[' (# Match any character except Start Capture Group 1 [^ |] + # '|' and repeat it once or more) # End Capture Group 1 \ | # Character '|' Match [^]] * # matches any character ']' and repeat it zero or more often] # character matches ']'
AC # Will appear:
string test = "dafasdfasdf adfasd [test | http: //www.test.com/] ADF ddasfasdf [SDAF | http: //www.madee.com/] "; Adjust the string = reggaex Replay (test, @ "\ [([^ |] +) \ | [^]] *]", "$ 1");
Comments
Post a Comment