gpt4 book ai didi

regex - 如何使用 Perl 正则表达式提取已知标记前后的文本?

转载 作者:行者123 更新时间:2023-12-04 07:10:00 25 4
gpt4 key购买 nike

谁能告诉我如何识别中间部分interestedInThis并反向引用前缀:fontsize=12和后缀:fontstyle=bold${1}${2} ?

我正在处理这个字符串:

<fontsize=12 interestedInThis fontstyle=bold>

附录:抱歉,我不够精确,以下是具体内容:
  • 前缀和后缀可能不存在
  • prefix 和 postfix 可以是任何字符串,不一定是 fontsize,resp。 fontstyle
  • 我肯定知道,我在找什么,即 interestedInThis它将通过空格分隔。
  • 最佳答案

    <([^>]*)interestedInThis([^>]*)>

    关于regex - 如何使用 Perl 正则表达式提取已知标记前后的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/521996/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com