search

Home  >  Q&A  >  body text

node.js - nodejs 正则匹配,cpu达到100%的问题

PHPzPHPz2783 days ago571

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:48:20

    Visually guess that the place where you are stuck is <p...> because every p needs to be matched and searched

    Modify the expression to

    <p\sclass="bbs-content[^"']*clearfix">(.*?)<p\sid="alt_action"[^>]*class="clearfix">

    They generally don’t change the structure of p randomly, so the above expression can be matched

    The speed can be more than 1 times faster

    You can see that the $0 $1 below has been matched

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:48:20

    The g descriptor of the regular expression is removed.

    reply
    0
  • Cancelreply