在 Fiddlers CustomRules.js 中使用 RegExp.$1
我已经使用 Fiddler 几天了,用我自己的逻辑扩展 CustomRules.js。
我尝试使用正则表达式从响应正文中获取一些信息
这是我从 http://msdn.microsoft.com/en-us/library/bahdt634%28v=VS.71%29.aspx
var s : String;
var re : RegExp = new RegExp("d(b+)(d)","ig");
var str : String = "cdbBdbsbdbdz";
var arr : Array = re.exec(str);
s = RegExp.$1;
但是使用这个当我保存文件时,fiddler 会出错。不支持说 RegExp.$1。
我认为这与 (http:// msdn.microsoft.com/en-us/library/bahdt634%28v=VS.71%29.aspx)
注意 RegExp 对象的属性在快速运行时不可用模式,JScript .NET 的默认模式。要从使用这些属性的命令行编译程序,必须使用 /fast- 关闭快速选项。在 ASP.NET 中关闭快速选项并不安全,因为快速模式未关闭。
但是如何在 CustomRules.js 中切换快速模式?这可能吗?
I've been using Fiddler for a few days now, extending CustomRules.js with my own logic.
I tried to grab some information out of the response body using regular expressions
This is what I copied from http://msdn.microsoft.com/en-us/library/bahdt634%28v=VS.71%29.aspx
var s : String;
var re : RegExp = new RegExp("d(b+)(d)","ig");
var str : String = "cdbBdbsbdbdz";
var arr : Array = re.exec(str);
s = RegExp.$1;
However using this in fiddler will give an error when I save the file. Saying RegExp.$1 is not supported.
I assume this is related to (http://msdn.microsoft.com/en-us/library/bahdt634%28v=VS.71%29.aspx)
Note The properties of the RegExp object are not available when running in fast mode, the default for JScript .NET. To compile a program from the command line that uses these properties, you must turn off the fast option by using /fast-. It is not safe to turn off the fast option in ASP.NET becafast mode is not switched of.
However how do I switch of fast mode in CustomRules.js? Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不了解 JScript,但在 JavaScript 中
RegExp.prototype.exec
返回null
或数组,其成员是匹配的子字符串及其捕获的组。所以你的
s
将是arr[1]
。Don't know about JScript, but in JavaScript
RegExp.prototype.exec
returnsnull
or an array, which members are the matched substring followed by its captured groups.So your
s
would bearr[1]
.