NotePad用正则表达式,怎么将WIDTH="数字"统一替换成WIDTH="255"

ron_xin 2020-01-25 01:54:17

<?xml version="1.0"?><DATAPACKET Version="2.0"><METADATA><FIELDS><FIELD attrname="TICKETCODE" fieldtype="string" WIDTH="12"/><FIELD attrname="NAME" fieldtype="string" WIDTH="19"/><FIELD attrname="SURNAME" fieldtype="string" WIDTH="32"/><FIELD attrname="GIVENNAME" fieldtype="string" WIDTH="32"/><FIELD attrname="GENDER" fieldtype="string" WIDTH="1"/><FIELD attrname="IDTYPE" fieldtype="string" WIDTH="1"/><FIELD attrname="IDNUMBER" fieldtype="string" WIDTH="44"/><FIELD attrname="DATEOFBIRTH" fieldtype="string" WIDTH="10"/><FIELD attrname="NATION" fieldtype="string" WIDTH="32"/><FIELD attrname="DATEOFEXPRY" fieldtype="string" WIDTH="10"/><FIELD attrname="FG" fieldtype="string" WIDTH="1"/><FIELD attrname="CHECKA" fieldtype="string" WIDTH="1"/><FIELD attrname="CHECKB" fieldtype="string" WIDTH="1"/><FIELD attrname="AGATECHECKINTIME" fieldtype="string" WIDTH="19"/><FIELD attrname="BGATECHECKINTIME" fieldtype="string" WIDTH="19"/><FIELD attrname="AIRWAYS" fieldtype="string" WIDTH="32"/><FIELD attrname="FLIGHTNUMBER" fieldtype="string" WIDTH="32"/><FIELD attrname="COMEFROM" fieldtype="string" WIDTH="32"/><FIELD attrname="ISSUINGCOUNTRY" fieldtype="string" WIDTH="32"/><FIELD attrname="ISSUEDAT" fieldtype="string" WIDTH="32"/><FIELD attrname="BIRTHPLACEPINYIN" fieldtype="string" WIDTH="32"/><FIELD attrname="IDNOTAIWAN" fieldtype="string" WIDTH="32"/></FIELDS><PARAMS/></METADATA><ROWDATA/><METADATA><FIELDS><FIELD attrname="TICKETCODE" fieldtype="string" WIDTH="12"/><FIELD attrname="NAME" fieldtype="string" WIDTH="19"/><FIELD attrname="SURNAME" fieldtype="string" WIDTH="32"/><FIELD attrname="GIVENNAME" fieldtype="string" WIDTH="32"/><FIELD attrname="GENDER" fieldtype="string" WIDTH="1"/><FIELD attrname="IDTYPE" fieldtype="string" WIDTH="1"/><FIELD attrname="IDNUMBER" fieldtype="string" WIDTH="44"/><FIELD attrname="DATEOFBIRTH" fieldtype="string" WIDTH="10"/><FIELD attrname="NATION" fieldtype="string" WIDTH="32"/><FIELD attrname="DATEOFEXPRY" fieldtype="string" WIDTH="10"/><FIELD attrname="FG" fieldtype="string" WIDTH="1"/><FIELD attrname="CHECKA" fieldtype="string" WIDTH="1"/><FIELD attrname="CHECKB" fieldtype="string" WIDTH="1"/><FIELD attrname="AGATECHECKINTIME" fieldtype="string" WIDTH="19"/><FIELD attrname="BGATECHECKINTIME" fieldtype="string" WIDTH="19"/><FIELD attrname="AIRWAYS" fieldtype="string" WIDTH="32"/><FIELD attrname="FLIGHTNUMBER" fieldtype="string" WIDTH="32"/><FIELD attrname="COMEFROM" fieldtype="string" WIDTH="32"/><FIELD attrname="ISSUINGCOUNTRY" fieldtype="string" WIDTH="32"/><FIELD attrname="ISSUEDAT" fieldtype="string" WIDTH="32"/><FIELD attrname="BIRTHPLACEPINYIN" fieldtype="string" WIDTH="32"/><FIELD attrname="IDNOTAIWAN" fieldtype="string" WIDTH="32"/></FIELDS><PARAMS/></METADATA><ROWDATA/></DATAPACKET>

...全文
168 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
X-i-n 2020-01-29
  • 打赏
  • 举报
回复
(?<=WIDTH="):逆序环视,查找条件为左边内容是WIDTH=,同时这一匹配条件并不加入查找结果(查找结果不包含 WIDTH=); \d+:\d等效于[0-9],最长限度地匹配数字,直到出现非数字为止。 最终的匹配效果就是尽可能长地匹配数字,匹配条件是“左边内容是WIDTH=”,然后把这个数字替换为255。
ron_xin 2020-01-28
  • 打赏
  • 举报
回复
引用 1 楼 X-i-n 的回复:
(?<=WIDTH=")\d+ 替换为 255
可以使用,能说明一下么?
X-i-n 2020-01-25
  • 打赏
  • 举报
回复
(?<=WIDTH=")\d+ 替换为 255

4,164

社区成员

发帖
与我相关
我的任务
社区描述
Windows专区 一般软件使用
社区管理员
  • 一般软件使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧