提取ID值,WITH "
Extract the ID value, WITH "
给定以下代码:
<div class="image-holder ui-draggable" title="something" id="image-138-1"
style="height: 20px; width: 20px; background-image: url("http://example.com/userdata/138/image_5beb36c29fe79f5590054d05164c88f7.
gif"); left: 0px; top: 0px; position: relative;"></div><div
class="image-holder ui-draggable" title="something2" id="image-15230-4"
style="height: 40px; width: 40px; background-image: url("http://example.com/userdata/135238/image_5beb36c29fwrdfsdfd05164c88f7.g
if"); left: 0px; top: 0px; position: relative;"></div><div
class="image-holder ui-draggable" title="somethinggfhgf" id="image-1388973-1"
style="height: 30px; width: 10px; background-image: url("http://example.com/userdata/13456548/image_5beb3646456164c88f7.gif"
;); left: 0px; top: 50px; position: relative;"></div>
如何使用 Notepad++ 提取带有“ ”的 id-s 值。
示例:"image-138-1" "image-15230-4" "image-1388973-1"
正则表达式 (?<=id=)"image-\d+-\d+"
将查找文字文本 "image-
后跟一位或多位数字后跟文字文本 -
后跟一位或多位数字后跟文字文本 "
。所有这些都必须以文字文本 id=
开头,但是在结果匹配中不会出现..
正在使用此模式执行 Find All in Current Document
...
...匹配您在第 1、4 和 7 行列出的三个示例字符串(但不包括前面的 id=
)。
编辑:
基于 this SuperUser answer (and 显示了相同的概念),我能够使以下工作正常进行:
Search
⮕ Replace...
在 Regular expression
模式下 Find what: (?<=id=)("image-\d+-\d+")
和 Replace with: \n%%\n
。单击 Replace All
按钮。
Search
⮕ Mark...
在 Regular expression
模式下启用 Find what: %(.*?)%
和 Bookmark line
。单击 Mark All
按钮。
Search
⮕Bookmark
⮕Remove Unmarked Lines
- (可选)
Search
⮕ Bookmark
⮕ Clear All Bookmarks
给定以下代码:
<div class="image-holder ui-draggable" title="something" id="image-138-1"
style="height: 20px; width: 20px; background-image: url("http://example.com/userdata/138/image_5beb36c29fe79f5590054d05164c88f7.
gif"); left: 0px; top: 0px; position: relative;"></div><div
class="image-holder ui-draggable" title="something2" id="image-15230-4"
style="height: 40px; width: 40px; background-image: url("http://example.com/userdata/135238/image_5beb36c29fwrdfsdfd05164c88f7.g
if"); left: 0px; top: 0px; position: relative;"></div><div
class="image-holder ui-draggable" title="somethinggfhgf" id="image-1388973-1"
style="height: 30px; width: 10px; background-image: url("http://example.com/userdata/13456548/image_5beb3646456164c88f7.gif"
;); left: 0px; top: 50px; position: relative;"></div>
如何使用 Notepad++ 提取带有“ ”的 id-s 值。 示例:"image-138-1" "image-15230-4" "image-1388973-1"
正则表达式 (?<=id=)"image-\d+-\d+"
将查找文字文本 "image-
后跟一位或多位数字后跟文字文本 -
后跟一位或多位数字后跟文字文本 "
。所有这些都必须以文字文本 id=
开头,但是在结果匹配中不会出现..
正在使用此模式执行 Find All in Current Document
...
...匹配您在第 1、4 和 7 行列出的三个示例字符串(但不包括前面的 id=
)。
编辑:
基于 this SuperUser answer (and
Search
⮕Replace...
在Regular expression
模式下Find what: (?<=id=)("image-\d+-\d+")
和Replace with: \n%%\n
。单击Replace All
按钮。Search
⮕Mark...
在Regular expression
模式下启用Find what: %(.*?)%
和Bookmark line
。单击Mark All
按钮。Search
⮕Bookmark
⮕Remove Unmarked Lines
- (可选)
Search
⮕Bookmark
⮕Clear All Bookmarks