Click here to Skip to main content
14,331,194 members

-Regular Expression formula problem-

_Q12_ asked:

Open original thread
I have 26 files with text inside them and I want to remove some [special groups of words] from all of them. I have a specific group of text to remove, right now.
I'm comfortable with other solutions different than using regex, but I wish though to find a solution in this direction(if possible).
---------------------------------------
sample:
< I>(î áëþäàõ â ðåñòîðàíå)< /I>
< I>(÷åã,î-ë. — of)< /I>
< I>n< /I>
< I>áèáë.< /I>
---------------------------------------

I am thinking at using RegularExpressions on it but I need a regex formula for finding < I>, any word inside ,and stop After finding < /I>.
I know I can use @"< I>\w*" but further I can't imagine any combination possible...

//obs: there is no space between < and I>; 
//i put it here because interfere with this  html page.
                     if (line[1].Contains("< I>"))
                     {
                        string[] segment = Regex.Split(line[1], "< I>");
                     }

(PS- my English is not as good as a native one; also my level in c# is not so advanced. Thank you for understanding.)

---continued:
I found a nice regex snippet that look promising:
"[^"]*"  [solution to match any string within double quotes]

Right now I am delving into regex, and it will took some time until I will familiarize with it. Until then this case will remain open unfortunately. In the end I will close it. If you will find something useful in the meantime, I will look over it. Thanks.
Tags: C#

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100