我有一个如下所示的xml:
<example id='1'>
<val name='test1'/>
</example>
<example id='2' command='delete'>
<val name='test2'/>
</example>
<example id='3'>
<val name='test3'/>
</example>
我正在尝试在记事本++中使用正则表达式删除带有 commands ='delete'的所有 example 项,因此在上面的示例中,test1和test3应该是剩下的。
我可以轻松地执行没有值的操作,如下所示,但这只是具有值的操作。
<example id='1' command='delete' />
答案 0 :(得分:3)
您可以使用
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
animation: example 5s linear infinite;
transform-origin: 75% 75%;
}
/* Safari 4.0 - 8.0 */
@-webkit-keyframes example {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Standard syntax */
@keyframes example {
from {
-ms-transform: rotate(0deg);
}
to {
-ms-transform: rotate(360deg);
}
}
</style>
</head>
<body>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
<div></div>
</body>
</html>
(启用“点匹配换行符”)
并替换为空字符串。
答案 1 :(得分:1)
做到这一点:
String queueNames = String.format("projects/%s/locations/%s/queues/%s", _projectName,_location, queueName);
// Create the PullTasksRequest
LeaseTasksRequest request = new LeaseTasksRequest().setMaxTasks(tasksBulkSize).setLeaseDuration(String.valueOf(leaseTimeInSecs)+"s").setResponseView("FULL");
//Execute the request and return the pulled task
LeaseTasksResponse response = _cloudTasksClient
.projects()
.locations()
.queues()
.tasks()
.lease(queueNames, request)
.execute();
return response.getTasks();
记住要检查“匹配换行符”。
答案 2 :(得分:1)
请使用搜索模式:“正则表达式”与“。匹配换行符”
<example.[^>]*command='delete'.*?</example>