【问题标题】:Is there a way to search for a string that searches all characters including "<" characters?有没有办法搜索搜索所有字符(包括“<”字符)的字符串?
【发布时间】:2021-07-29 23:51:14
【问题描述】:

我会尽量具体一点。我尝试使用 ..text.content 和 ..innerhtml 并且在搜索时似乎都缺少“

这是我在特定 html 页面上搜索的内容。

'''

    '231-8&quot;},&quot;availability_html&quot;:&quot;&lt;p class=\&quot;stock out-of-stock'

''' 这是我的代码...

    'if ('
    'document.documentElement.textContent.search('231-8&quot;},&quot;availability_html&quot;:&quot;&lt;p class=\&quot;stock out-of-stock') != -1)'
    '{'
    'alert("FOUND!");'
    '} else {'
    'alert("NOT FOUND!");'
    '}' 

''' 我可以搜索字符串的第一部分一直到“&lt”部分,它工作正常。

我做错了什么?

【问题讨论】:

  • 我发现这是我的解决方案 231-8"},"availability_html":"

标签: innerhtml


【解决方案1】:

这是我想出来的解决方案...

    '231-8&quot;},&quot;availability_html&quot;:&quot;<p class=\\\\&quot;stock out-of-stock

【讨论】:

    猜你喜欢
    • 2018-04-17
    • 2016-01-11
    • 2017-07-04
    • 2011-03-22
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    • 1970-01-01
    相关资源
    最近更新 更多