学习笔记——正则表达式使用

使用正则表达式提取内容

内容例子:

[
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "545414",
        "_score" : 9.61432,
        "_source" : {
          "sn" : "M2408140000996"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "628713",
        "_score" : 9.356711,
        "_source" : {
          "sn" : "M2408230003154"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "631762",
        "_score" : 9.324027,
        "_source" : {
          "sn" : "M2408230006203"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "635606",
        "_score" : 9.324027,
        "_source" : {
          "sn" : "M2408240002407"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "620172",
        "_score" : 9.025081,
        "_source" : {
          "sn" : "M2408220003317"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "611333",
        "_score" : 9.020051,
        "_source" : {
          "sn" : "M2408210003178"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "631886",
        "_score" : 8.973799,
        "_source" : {
          "sn" : "M2408230006327"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "586238",
        "_score" : 8.973799,
        "_source" : {
          "sn" : "M2408180003131"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "635464",
        "_score" : 8.963459,
        "_source" : {
          "sn" : "M2408240002265"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "601122",
        "_score" : 8.662678,
        "_source" : {
          "sn" : "M2408200002191"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "635595",
        "_score" : 8.519331,
        "_source" : {
          "sn" : "M2408240002396"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "570701",
        "_score" : 8.512436,
        "_source" : {
          "sn" : "M2408160008883"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "613900",
        "_score" : 8.477981,
        "_source" : {
          "sn" : "M2408210005745"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "548693",
        "_score" : 8.226451,
        "_source" : {
          "sn" : "M2408140004279"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "634194",
        "_score" : 8.159914,
        "_source" : {
          "sn" : "M2408240000995"
        }
      },
      {
        "_index" : "new_order",
        "_type" : "_doc",
        "_id" : "619750",
        "_score" : 8.159914,
        "_source" : {
          "sn" : "M2408220002895"
        }
      }
    ]

将上面文档粘贴到sublime Test 中

键盘按键ctrl +F 出来查找窗口

数据下面正则表达式:

"sn"\s*:\s*"(.*?)"

点击sublime Text的Find All   复制匹配上的内部,粘贴到其他文档处理即可。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值