0

I am cleaning some HTML strings and would like to remove empty spaces between > and < characters.

This is an example of my string:

<h4>Specifications</h4>    <table>  <tr>  <td>Brand</td>    <td>Dell</td>    </tr>  </table>

I would like to remove those X empty spaces between html tags.

Community
  • 1
  • 1
gdolenc
  • 301
  • 1
  • 2
  • 17
  • Please read [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/a/284237/3219613) and show us what you have tried so far. Then ask a *specific* question to the code you have tried. – Pᴇʜ May 09 '17 at 06:46
  • Quick solution: Trim function or clean – Sgdva May 09 '17 at 06:54
  • start here: http://stackoverflow.com/questions/22542834/how-to-use-regular-expressions-regex-in-microsoft-excel-both-in-cell-and-loops – avb May 09 '17 at 06:55
  • @Sgdva, trim will not clear spaces inside a string, only leading and trailing – avb May 09 '17 at 06:57
  • @avb You're right, my bad. He can use substitute " " for "". – Sgdva May 09 '17 at 07:17

1 Answers1

0

Pretty straight-forward:

>\s+<
# match >
# 1+ whitespaces
# <

This needs to be replaced by ><, see a demo on regex101.com.

Jan
  • 42,290
  • 8
  • 54
  • 79