diff --git a/w3lib/html.py b/w3lib/html.py
index 9990a35..55fe5e3 100644
--- a/w3lib/html.py
+++ b/w3lib/html.py
@@ -220,7 +220,7 @@ def remove_tags_with_content(text, which_ones=(), encoding=None):
 
     text = to_unicode(text, encoding)
     if which_ones:
-        tags = '|'.join([r'<%s.*?</%s>|<%s\s*/>' % (tag, tag, tag) for tag in which_ones])
+        tags = '|'.join([r'<%s\b.*?</%s>|<%s\s*/>' % (tag, tag, tag) for tag in which_ones])
         retags = re.compile(tags, re.DOTALL | re.IGNORECASE)
         text = retags.sub(u'', text)
     return text

remove_tags_with_content bug
use this 
`remove_tags_with_content("""<div class="hqimg_related"><div class="to_page"><span>热点栏目</span> <s class='hotSe'></s>""", ("s",))`
get result:
`<div class="hqimg_related"><div class="to_page">`
There may be some mistakes
then modified the expression. 
`tags = '|'.join([r'<%s\s+.*?</%s>|<%s\s*/>' % (tag, tag, tag) for tag in which_ones])`
finally,it's work fine

diff --git a/tests/test_html.py b/tests/test_html.py
index 68133cb..6d6e8ae 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -184,6 +184,10 @@ class RemoveTagsWithContentTest(unittest.TestCase):
         # text with empty tags
         self.assertEqual(remove_tags_with_content(u'<br/>a<br />', which_ones=('br',)), u'a')
 
+    def test_tags_with_shared_prefix(self):
+        # https://github.com/scrapy/w3lib/issues/114
+        self.assertEqual(remove_tags_with_content(u'<span></span><s></s>', which_ones=('s',)), u'<span></span>')
+
 
 class ReplaceEscapeCharsTest(unittest.TestCase):
     def test_returns_unicode(self):

pip install -e .
parse_log_pytest
pytest
nose nose-cov pytest
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
cov-core==1.15.0
coverage==7.2.7
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
nose==1.3.7
nose-cov==1.6
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
-e git+https://github.com/scrapy/w3lib.git@0108fab2f627b2bfdf3d6942a44ed10a78ff443f#egg=w3lib
zipp @ file:///croot/zipp_1672387121353/work

name: w3lib
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib-metadata=4.11.3=py37h06a4308_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - typing_extensions=4.4.0=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cov-core==1.15.0
      - coverage==7.2.7
      - nose==1.3.7
      - nose-cov==1.6
      - six==1.17.0
prefix: /opt/conda/envs/w3lib

tests/test_html.py::RemoveTagsWithContentTest::test_tags_with_shared_prefix
tests/test_html.py::RemoveEntitiesTest::test_browser_hack tests/test_html.py::RemoveEntitiesTest::test_encoding tests/test_html.py::RemoveEntitiesTest::test_illegal_entities tests/test_html.py::RemoveEntitiesTest::test_keep_entities tests/test_html.py::RemoveEntitiesTest::test_missing_semicolon tests/test_html.py::RemoveEntitiesTest::test_regular tests/test_html.py::RemoveEntitiesTest::test_returns_unicode tests/test_html.py::ReplaceTagsTest::test_replace_tags tests/test_html.py::ReplaceTagsTest::test_replace_tags_multiline tests/test_html.py::ReplaceTagsTest::test_returns_unicode tests/test_html.py::RemoveCommentsTest::test_no_comments tests/test_html.py::RemoveCommentsTest::test_remove_comments tests/test_html.py::RemoveCommentsTest::test_returns_unicode tests/test_html.py::RemoveTagsTest::test_keep_argument tests/test_html.py::RemoveTagsTest::test_remove_empty_tags tests/test_html.py::RemoveTagsTest::test_remove_tags tests/test_html.py::RemoveTagsTest::test_remove_tags_with_attributes tests/test_html.py::RemoveTagsTest::test_remove_tags_without_tags tests/test_html.py::RemoveTagsTest::test_returns_unicode tests/test_html.py::RemoveTagsTest::test_uppercase_tags tests/test_html.py::RemoveTagsWithContentTest::test_empty_tags tests/test_html.py::RemoveTagsWithContentTest::test_returns_unicode tests/test_html.py::RemoveTagsWithContentTest::test_with_tags tests/test_html.py::RemoveTagsWithContentTest::test_without_tags tests/test_html.py::ReplaceEscapeCharsTest::test_returns_unicode tests/test_html.py::ReplaceEscapeCharsTest::test_with_escape_chars tests/test_html.py::ReplaceEscapeCharsTest::test_without_escape_chars tests/test_html.py::UnquoteMarkupTest::test_returns_unicode tests/test_html.py::UnquoteMarkupTest::test_unquote_markup tests/test_html.py::GetBaseUrlTest::test_attributes_before_href tests/test_html.py::GetBaseUrlTest::test_get_base_url tests/test_html.py::GetBaseUrlTest::test_get_base_url_latin1 tests/test_html.py::GetBaseUrlTest::test_get_base_url_latin1_percent tests/test_html.py::GetBaseUrlTest::test_get_base_url_utf8 tests/test_html.py::GetBaseUrlTest::test_no_scheme_url tests/test_html.py::GetBaseUrlTest::test_relative_url_with_absolute_path tests/test_html.py::GetBaseUrlTest::test_tag_name tests/test_html.py::GetMetaRefreshTest::test_commented_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_entities_in_redirect_url tests/test_html.py::GetMetaRefreshTest::test_float_refresh_intervals tests/test_html.py::GetMetaRefreshTest::test_get_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_html_comments_with_uncommented_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_inside_noscript tests/test_html.py::GetMetaRefreshTest::test_inside_script tests/test_html.py::GetMetaRefreshTest::test_leading_newline_in_url tests/test_html.py::GetMetaRefreshTest::test_multiline tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_latin1 tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_latin1_query tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_utf8 tests/test_html.py::GetMetaRefreshTest::test_relative_redirects tests/test_html.py::GetMetaRefreshTest::test_tag_name tests/test_html.py::GetMetaRefreshTest::test_without_url
w3lib/html.py
w3lib/html.py