天天看點

正規表達式例子

  正規表達式例子1

  reg:

  (\"\w.*\"[:]\"\w.*\")|(\"\w.*\"[:]\[\w.*\])

  source: {"domain":"mzwu.com", "years":[2006,2007,2008,2009,2010]} result: "domain":"mzwu.com" "years":[2006,2007,2008,2009,2010] //----- 正規表達式例子2

  //reg:

  \(0\d{2,3}\)[-]?\d{8}|0\d{2,3}[-]?\d{8}

  source:

  {(028)-34567890

  (231+38383743)

  [(0211)-22323623]}

  result:

  (028)-34567890

  (0211)-22323623

  //-----

  QQ号碼:

  reg:

  ^\d{5,12}$

  result:5到12位數字

  //-----

  電子郵件:

  reg:

  \w+[@]\w+[.]\w+

  source:

  [email protected]

  [email protected]

  28242_1@.

  [email protected]

  result:

  [email protected]

  [email protected]

  [email protected]

  //-----

  正規表達式例子3

  //reg:

  \"\w.*\"[:]\"\w.*\"

  source:

  source:

  {"weatherinfo":

  {"city":"北京",

  "city_en":"beijing",

  "date_y":"2011年5月31日",

  "date":"辛卯年",

  "week":"星期二",

  "fchh":"18",

  "cityid":"101010100",

  "temp1":"18℃~32℃",

  "temp2":"19℃~34℃",

  "temp3":"23℃~33℃",

  "temp4":"23℃~29℃",

  "temp5":"18℃~31℃",

  "temp6":"18℃~35℃",

  "tempF1":"64.4