找到2点之间的字符串,并在另外2点之间移动

I have a lot of urls that are sadly static, to change them I need to use some type of application or script.. I have about 400 files with urls ranging from 15-150 on each.

Here is an example of what I'm trying to do:

Change:
<td class="SELECTX"><strong>Text example 1 <a href=""></a>Text Example 2 </strong></td>

To:
<td class="SELECTX"><strong> <a href=""></a>Text example 1 Text Example 2 </strong></td>

I would love a way to change this on all files at once, but if I can't then at least a way to where I can change all urls on 1 file without having to do manual cut and paste.

I searched and searched for over 3 hours and found nothing... I hope someone can help.

Edit: Basically I'm trying to find the text/string between <strong and <a href= which would be "Text example 1" then move it to go after ""></a> . Which would now come before "Text Example 2"

To find the string between the two (or ) tag's I'd probably just use a regular expression to find where in the file the strings are, then process each string/line in a script.

Then maybe for each line, find the opening tag and the closing tag which would give me the indexes of the section of the string that needs swapping, and swap the 2 pieces along the index of the opening tag.

Please check this it works exactly for your need

    String s = "<td class=\"SELECTX\"><strong>Text example 1 <a href=\"\"></a>Text Example 2 </strong></td>";
    s = s.replace("<a href=\"\"></a>", " ").replace("<strong>", "<strong><a href=\"\"></a>");
#!/bin/bash 
while read line
do
     x=`echo $line |grep -o "strong>.*<a" | sed 's/strong>//' |sed 's/<a//'`
     y=`echo $line |grep -o "a>.*</strong" | sed 's/a>//' |sed 's/<\/strong//'`
     z=`echo $line| sed 's/'"$x"'//' |sed 's/'"$y"'/'"$x $y"'/'`
    echo $z
done < a.txt

Append the output of this script to another file and that will be your expected output. You can put a for loop to iterate all the files in that directory.

If you want to replicate this in java here is the logic.

String X = "Text example 1"

String Y = "Text example 2"

String Z = X+(concatenate)+ Y

replace "Text example 1" with ' '

replace"Text example 2" with String Z.