How to remove unnecessary space from tags?

How to remove unnecessary space from tags?

81
Advanced UserAdvanced User
81

    Oct 18, 2017#1

    How do I remove spaces immediately after the tags <sub> or <sup> and immediately before the closing tags </sub> or </sup> in one replace?
    Sample text

    Code: Select all

    Today <sup> 1</sup> is <sup> x </sup> the day <sub> y</sub> when <sub>y </sub> 15 people <sup> 5 </sup> died <sub> 5 </sub>
    Expected output

    Code: Select all

    Today <sup>1</sup> is <sup>x</sup> the day <sub>y</sub> when <sub>y</sub> 15 people <sup>5</sup> died <sub>5</sub>
    I can find using (<su(b|p)>)\s|\s(</su(b|p)>) but how do I replace?

    6,602548
    Grand MasterGrand Master
    6,602548

      Oct 18, 2017#2

      I suggest to use as search string (?<=<su[bp]>)[\t ]+|[\t ]+(?=</su[bp]>) with a positive look-behind and a positive look-ahead searching for tabs/spaces in an OR expression with an empty string as replace string.
      Best regards from an UC/UE/UES for Windows user from Austria

      81
      Advanced UserAdvanced User
      81

        Oct 19, 2017#3

        Thanks Mofi :)