1

how can I replace the following text in python/javascript

Latency=45.466<span class="interval"> ± 11.462</span>;pass

in a way that it can show final text like this:

Latency=45.466±11.462;pass
bornomala
  • 115
  • 2
  • 12

1 Answers1

0

You just have to remove the html tags, for that, you can use:

import re
subject = 'Latency=45.466<span class="interval"> ± 11.462</span>;pass'
result = re.sub("<[^>]+>| ", "", subject)
print result
# Latency=45.466±11.462;pass

Python Demo


For JavaScript you can use:

subject = 'Latency=45.466<span class="interval"> ± 11.462</span>;pass'
result = subject.replace(/<[^>]+>| /g, "");
console.log(result);
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268