为以下格式编写正则表达式

问题描述 投票:0回答:2

你能帮忙将以下当前格式的正则表达式编写为预期格式吗?

当前格式数据:

web_add_auto_header("Origin",  
      "http://eesere6090582.loot.welcome.com:8888");
web_add_auto_header("Wicket-Ajax",  
      "true");
web_add_auto_header("Wicket-Ajax-BaseURL",  
      "servers?1");
web_add_auto_header("Wicket-FocusedElementId",  
      "id40");
web_add_auto_header("X-Requested-With",  
      "XMLHttpRequest");

预期格式:

web_add_auto_header("Origin","http://eesere6090582.loot.welcome.com:8888");
web_add_auto_header("Wicket-Ajax","true");
web_add_auto_header("Wicket-Ajax-BaseURL","servers?1");
web_add_auto_header("Wicket-FocusedElementId","id40");
web_add_auto_header("X-Requested-With","XMLHttpRequest");
jmeter loadrunner
2个回答
0
投票

假设字符串开头的空格可能是制表符或多个单个空格,..你的正则表达式可能看起来像:

",\n\s+"   replace with   "\,"

https://regex101.com/r/7J4sC7/1


0
投票

使用正则表达式

^(web_add_auto_header.*,)\n\s*
替换
$1
.

它将替换以

web_add_auto_header
开头的字符串后的换行符。

这里是 regex101 的演示

© www.soinside.com 2019 - 2024. All rights reserved.