V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
SolidZORO
V2EX  ›  问与答

正则表达式提问

  •  
  •   SolidZORO · 2011-02-17 16:58:00 +08:00 · 4674 次点击
    这是一个创建于 4841 天前的主题,其中的信息可能已经有所发展或是发生改变。
    012279
    012280
    012281

    011913
    011578

    013173

    程序异常:MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Exception: 引发类型为“System.Exception”的异常。
    在 MySql.Data.MySqlClient.NativeDriver.Open()
    --- 内部异常堆栈跟踪的结尾 ---
    在 MySql.Data.MySqlClient.NativeDriver.Open()
    在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
    在 MySql.Data.MySqlClient.MySqlPool.GetConnection()
    在 MySql.Data.MySqlClient.MySqlConnection.Open()
    在 Readwrite.sqlhelp.getMyDate(String sql) 位置 Readwrite\sqlhelp.cs:行号 46
    在 Readwrite.Form1.InsertGoods()\Readwrite\Form1.cs:行号 103


    ----------------------------------------------
    这个是同事交给我的一个问题。是想找013173 这样的数字,我用^\d{6}$,能把他们找出来,但是我想反过来呢? 应该怎么写? 我试了很久都没能搞定。
    8 条回复    1970-01-01 08:00:00 +08:00
    jimmy
        1
    jimmy  
       2011-02-17 17:04:09 +08:00
    反过来找什么?
    SolidZORO
        2
    SolidZORO  
    OP
       2011-02-17 17:10:57 +08:00
    除了000000这样的六位数字。都找。
    mifan
        3
    mifan  
       2011-02-17 17:19:15 +08:00
    得到结果, 再查一次, 把 000000 去掉
    SolidZORO
        4
    SolidZORO  
    OP
       2011-02-17 17:21:06 +08:00
    @mifan 这种能一条语句喝成么?
    rikugun
        5
    rikugun  
       2011-02-17 17:21:22 +08:00
    反过来? 就是取前边6位不是数字的呗
    SolidZORO
        6
    SolidZORO  
    OP
       2011-02-17 17:23:12 +08:00
    @rikugun 这个要怎么写....
    rikugun
        7
    rikugun  
       2011-02-17 17:32:17 +08:00
    @SolidZORO ^(?!\d{6}).+
    SolidZORO
        8
    SolidZORO  
    OP
       2011-02-17 17:47:30 +08:00
    @rikugun 这个超赞,以至于你写出来我还得琢磨琢磨其中道理先。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2111 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 616ms · UTC 16:01 · PVG 00:01 · LAX 09:01 · JFK 12:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.