invite
V2EX  ›  问与答

浏览器页面搜索的时候,能不能加一个选型,提供正则搜索?

  •  
  •   invite · Mar 12, 2015 · 2770 views
    This topic created in 4079 days ago, the information mentioned may be changed or developed.

    目前有没有浏览器支持? 麻烦推荐一下。

    1 replies    2015-03-12 14:46:10 +08:00
    saber000
        1
    saber000  
       Mar 12, 2015
    用控制台吧,貌似都能支持.

    function rex_find(pattern){
    var regx = new RegExp(pattern, "igm");
    var results = [];
    while ((result = regx.exec(document.body.innerText)) != null){
    results.push(result[0]);
    }
    return results;
    }

    rex_find("\\d+")
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3377 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 12:18 · PVG 20:18 · LAX 05:18 · JFK 08:18
    ♥ Do have faith in what you're doing.