title: Search And Replace A Line In Java When The String Have Many Same Other Strings
body: <p>Ok you might have got idea what i am thinking </p>
  
  <p>okay i will go step by step to make things clear</p>
  
  <p>i have a file in android like here :- /sdcard/file.xml</p>
  
  <p>now i want to search the string name which is also present as same in this file</p>
  
  <p>like i have text like this in xml</p>
  
  <p>this is file.xml on different device</p>
  
  <pre><code>&lt;any name="class"&gt;
  &lt;index="23" /&gt;
  &lt;item name="item1" /&gt;
  &lt;item name="item2" /&gt;
  &lt;item name="item3" /&gt;
  &lt;/any&gt;
  &lt;any name="school"&gt;
  &lt;index="12" /&gt;
  &lt;item name="item2" /&gt;
  &lt;item name="item3" /&gt;
  &lt;item name="item1" /&gt;
  &lt;/any&gt;
  </code></pre>
  
  <p>this is file.xml on different device</p>
  
  <pre><code>&lt;any name="class"&gt;
  &lt;index="26" /&gt;
  &lt;item name="item2" /&gt;
  &lt;item name="item1" /&gt;
  &lt;item name="item3" /&gt;
  &lt;/any&gt;
  &lt;any name="school"&gt;
  &lt;index="11" /&gt;
  &lt;item name="item1" /&gt;
  &lt;item name="item3" /&gt;
  &lt;item name="item2" /&gt;
  &lt;/any&gt;
  </code></pre>
  
  <p>i am taking </p>
  
  <pre><code>&lt;any name="class"&gt; 
  </code></pre>
  
  <p>to search the word as it can not be different on devices</p>
  
  <p>but as you can see here the next index is different and items can be up and down as well</p>
  
  <p>but actually i want to replace item2 where ever it exist in <code>&lt;any name="class"&gt;</code> </p>
  
  <p>any way i can replace this ?</p>