laskuma
V2EX  ›  问与答

求助正则表达式(简单)

  •  
  •   laskuma · Feb 28, 2013 · 3574 views
    This topic created in 4894 days ago, the information mentioned may be changed or developed.
    从来没正经学过正则,只是能了解,能大概看懂的阶段。
    现在要写一个很简单的正则,用来提取html文件中去除标签之后的部分。
    提取所有标签的我会写
    觉得 <[^>]*> 差不多就可以了,说不定还会有错。。
    那请问如果要反过来用,要去掉这些标签,我的正则该怎么写呢?
    谢谢!
    2 replies    1970-01-01 08:00:00 +08:00
    laskuma
        1
    laskuma  
    OP
       Feb 28, 2013
    解决了。
    RoshanWu
        2
    RoshanWu  
       Feb 28, 2013
    sed 's/<[^>]*>//g' source.html > source.txt
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2703 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 15:07 · PVG 23:07 · LAX 08:07 · JFK 11:07
    ♥ Do have faith in what you're doing.