本文介绍了从匹配正则表达式的结果中删除最后一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在jmeter测试中提取html的一部分.

I'm trying to extract a part of html in a jmeter test.

我只需要从<script src=""标签中提取一部分.

I need to extract just a part from a <script src="" tag.

  • 完整脚本src:<script src="/Paginas/Inicializacao/AguardarAcao.aspx?_TSM_HiddenField_=ctl00_ToolkitScriptManager1_HiddenField&amp;_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d1.0.11119.38311%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apt-BR%3adf9c6e46-ef8c-4a3d-89af-f80adf22e9c2%3a865923e8%3a411fea1c%3ae7c87f07%3a91bd373d%3a1d58b08c%3a8e72a662%3aacd642d2%3a596d588c%3a77c58d20%3a14b56adc%3a269a19ae" type="text/javascript"></script>

  • full script src:<script src="/Paginas/Inicializacao/AguardarAcao.aspx?_TSM_HiddenField_=ctl00_ToolkitScriptManager1_HiddenField&amp;_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d1.0.11119.38311%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apt-BR%3adf9c6e46-ef8c-4a3d-89af-f80adf22e9c2%3a865923e8%3a411fea1c%3ae7c87f07%3a91bd373d%3a1d58b08c%3a8e72a662%3aacd642d2%3a596d588c%3a77c58d20%3a14b56adc%3a269a19ae" type="text/javascript"></script>

,我只需要:%3b%3bAjaxControlToolkit%2c+Version%3d1.0.11119.38311%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apt-BR%3adf9c6e46-ef8c-4a3d-89af-f80adf22e9c2%3a865923e8%3a411fea1c%3ae7c87f07%3a91bd373d%3a1d58b08c%3a8e72a662%3aacd642d2%3a596d588c%3a77c58d20%3a14b56adc%3a269a19ae

现在我创建了此正则表达式:

Right now I created this regex:

%3b.*"

符合的

%3b%3bAjaxControlToolkit%2c+Version%3d1.0.11119.38311%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apt-BR%3adf9c6e46-ef8c-4a3d-89af-f80adf22e9c2%3a865923e8%3a411fea1c%3ae7c87f07%3a91bd373d%3a1d58b08c%3a8e72a662%3aacd642d2%3a596d588c%3a77c58d20%3a14b56adc%3a269a19ae"

但是我不希望最后两个字符(一个空格)和".
如何删除最后两个字符?

But I don't want the last two chars (one white space) and the ".
How to remove this last two chars?

推荐答案

使用正则表达式模式

%[^"]+

这篇关于从匹配正则表达式的结果中删除最后一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 22:16