【问题标题】:How to count "/" in words, extracting tags (like </s>)如何计算单词中的“/”,提取标签(如</s>)
【发布时间】:2014-10-04 19:30:29
【问题描述】:

记事本++中的输入: &lt;s&gt;asmE/, asyE/, asmA/t, asyA/s, asya/, asmi/n, asyA/m, AByA/m, eBi/s, ABi/s, eBya/s, ABya/s, ezA/m, AsA/m, ezu/, Asu/&lt;/s&gt;http://regex101.com/r/yM2fA1/1

/ 用于在我使用的来自http://www.sanskrit-lexicon.uni-koeln.de/scans/PWGScan/2013/downloads/pwgxml.zip 的 XML 文档中标记重音。但如果我只计算/,我会得到&lt;/s&gt;&lt;/hom&gt;&lt;/h&gt; 等等。垃圾也算在内。如何排除 XML 标签?

【问题讨论】:

    标签: xml count notepad++


    【解决方案1】:

    怎么样:

    查找内容:(?&lt;!&lt;)/(?! ?&gt;)

    说明:

    (?<!<)  : lookbehind, there're no < before the slash
    /       : slash character to be searched
    (?! ?>) : lookahead, there're no > (eventualy preceded by a space) after the slash
    

    这是lookaround上的文档。

    【讨论】:

    • 纯粹的魔法,它就像一个魅力,只需几秒钟。 Lookaheadbehind 课程尚未由我学习。它很结实,没有污垢,很棒。
    • @gasyoun:很高兴它有帮助。
    【解决方案2】:

    仅用于计数目的:

    Ctrl+F 或从搜索 下拉菜单中单击查找,然后输入/ 作为要搜索的内容。现在点击 Find all in Current Document 。这应该会给你文档中的/ 的数量。记下这个数字。

    现在重复该过程,但现在搜索 &lt;/ 。计数的差异是您所需搜索的实际计数。

    【讨论】:

    • 坏主意。在我的 56 Mb 文档中,仅数 '/' 需要大约 20 分钟,我的 4 RAM,几百万个案例。我有四份定期更新的文件。所以我想在 EmEditor 或 Notepad++ 或 PHP 中一次性使用它,并带有一些 RegEx 魔法。没有我的计算器。
    • 您可以使用 Notepad++ 搜索多个文档。你搜索慢是不幸的。尝试复制粘贴文本并使用其他工具(如 ms word 或 google chrome 或 firefox 等)进行搜索。抱歉,我无法提供更多帮助
    猜你喜欢
    • 1970-01-01
    • 2015-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多