比如获取绿色字符串

ModelData.PayTableData =[{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_5.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_4.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_3.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""}];
ModelData.PayTableData1 =[{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_5.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_4.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_3.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""}]; ModelData.PayTableData2 =[{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_5.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_4.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""},
{"SlotID":"","GroupID":"","GroupH":"","GroupType":"","CellID":"","CellH":"","Row":"","ResType":"","Res":"Slot1&slot1_wild_3.png","ResVar":null,"X":"","Y":"","Scale":"0.7","Zorder":""}];

只需要

#editor:pengyingh
#encoding:utf-
#!/usr/bin/python
import os
import sys
import json
import string
import re
jsPath = sys.argv[]
#appendPath = jsPath[:jsPath.rindex('/') + ]
fp = open(jsPath, 'r')
rawStr = fp.read()
#print(rawStr[:])
m = re.search(r'ModelData.PayTableData\s*=\s*(\[.+?\])', rawStr, re.S)
if m:
print m.group()
else:
print 'no match'
fp.close()

python正则表达式获取两段标记内的字符串的更多相关文章

  1. Java 正则表达式获取两个字符中间的内容

    利用 正则表达式 获取两个字符串中间的值 直接上代码吧,不是很难. public static void main(String[] args) { // 内容 String value = &quo ...

  2. Python中使用正则表达式获取两个字符中间部分

    问题背景:当我们爬取网页信息时,对于一些标签的提取是没有意义的,所以需要提取标签中间的信息. 解决办法:用到了re包下的函数 方法1:用到了research()方法和group()方法 方法2:用到了 ...

  3. python正则表达式获取代理IP网站上的IP地址

    import urllib.request import re def open_url(url): req = urllib.request.Request(url) req.add_header( ...

  4. C# 获取一段日期内的工作日

    /// <summary> /// 根据指定时间段计算工作日天数 /// </summary> /// <param name="firstDay"& ...

  5. python正则表达式应用 定义一个函数,求字符串中出现的所有整数之和

  6. Python正则表达式如何进行字符串替换实例

    Python正则表达式如何进行字符串替换实例 Python正则表达式在使用中会经常应用到字符串替换的代码.有很多人都不知道如何解决这个问题,下面的代码就告诉你其实这个问题无比的简单,希望你有所收获. ...

  7. 【Python】【demo实验15】【练习实例】【两个数范围内素数的统计】

    原题: 判断101-200之间有多少个素数,并输出所有素数. 关于素数的统计,之前已经做过相应的实验了,参考:[显示素数,显示两个数范围内的所有素数] 原题给出的解法,使用math的sqrt函数,这个 ...

  8. FZU-2105 Digits Count (两种标记成段更新)

    题目大意:给n个0~15之间的数,有3种更新操作,1种询问操作.3种更新操作是:1.让某个闭区间的所有数字与一个0~15之间的数字进行逻辑与运算:2.让某个闭区间的所有数字与一个0~15之间的数字进行 ...

  9. python正则表达式re模块详细介绍--转载

    本模块提供了和Perl里的正则表达式类似的功能,不关是正则表达式本身还是被搜索的字符串,都可以是Unicode字符,这点不用担心,python会处理地和Ascii字符一样漂亮. 正则表达式使用反斜杆( ...

随机推荐

  1. GsonFormat的使用 (转)

    一.Android Studio快速添加Gson 具体操作:        1.File->Project Structure:   2.app->Dependencies->&qu ...

  2. 虚拟机安装的ubutun全屏

    虚拟机下面安装了ubuntu系统,显示的屏幕只有那么一小块儿,不知道如何才能全屏,那么如何全屏呢?且看下面经验.   方法/步骤     打开虚拟机,并点击要更改成全屏的那个ubuntu系统的电源 我 ...

  3. synchronized细节问题(二)

    使用synchronized声明的方法在某些情况下是有弊端的,比如A线程调用同步的方法执行一个很长时间的任务,那么B线程就必须等待比较长的时间才能执行,这样的情况下,可以使用synchronized代 ...

  4. 【转】以太网最大帧和最小帧、MTU

    根据rfc894的说明,以太网封装IP数据包的最大长度是1500字节,也就是说以太网最大帧长应该是以太网首部加上1500,再加上7字节的前导同步码和1字节的帧开始定界符,具体就是:7字节前导同步码 + ...

  5. 宝塔Linux面板 概述

    安装要求: Python版本: 2.6/2.7(安装宝塔时会自动安装) 内存:128M以上,推荐512M以上(纯面板约占系统10M内存) 硬盘:100M以上可用硬盘空间(纯面板约占20M磁盘空间) 系 ...

  6. [leetcode]123. Best Time to Buy and Sell Stock III 最佳炒股时机之三

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  7. Mac下IntelliJ的Git、GitHub配置及使用

    1.git简介 Git是目前流行的分布式版本管理系统.它拥有两套版本库,本地库和远程库,在不进行合并和删除之类的操作时这两套版本库互不影响.也因此其近乎所有的操作都是本地执行,所以在断网的情况下任然可 ...

  8. 克隆后没有IP

    删除文件:  /etc/udev/rules.d/70-persistent-net.rules 将/etc/sysconfig/network-scripts/ifcfg-eth0 中的HWADDR ...

  9. MBP 使用笔记

    1.svn下载指令(终端) svn checkout https://svn.openslam.org/data/svn/gmapping 参考:http://blog.csdn.net/q19910 ...

  10. 关于transform-style:preserve-3d的些许明了

    父元素要添加属性transform-style:preserve-3d;和transform:perspective(800px);还有相对定位 首先设置子元素 具有3D属性,然后再设置视角与3D元素 ...