- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将逗号分隔的列表与也包含逗号的前缀值匹配。
我终于让它匹配了所有没有 ,
的事件.
示例字符串(使用 NL 进行可视化 - 原始字符串没有 NL):
field01=Value 1,
field02=Value 2,
field03=<xml value>,
field04=127.0.0.1,
field05=User-Agent: curl/7.28.0\r\nHost: example.org\r\nAccept: */*,
field06=Location, Resource,
field07={Item 1},{Item 2}
我的实际 RegEx 看起来像这个未优化的部分....
(?'fields'(field[0-9]{2,3})=?([\s\w\d_<>.:="*?\-\/\\(){}<>'#]+))([^,](?&fields))*
任何人都知道如何解决这个问题?
asm01=Predictable Resource Location,Information Leakage,asm02=N/A,asm04=Uncategorized,asm08=2021-02-15 09:18:16,asm09=127.0.0.1,asm10=443,asm11=N/A,asm15=,asm16=DE,asm17=User-Agent: curl/7.29.0\r\nHost: dev.example.com\r\nAccept: */*\r\nX-Forwarded-For: 127.0.0.1\r\n\r\n,asm18=/Common/_www.example.com_live_v1,asm20=127.0.0.1,asm22=,asm27=HEAD,asm34=/Common/_www.example.com_live_v1,asm35=HTTPS,asm39=blocked,asm41=0,asm42=3,asm43=0,asm44=Error,asm46=200000028,200100015,asm47=Unix hidden (dot-file) access,.htaccess access,asm48={Unix/Linux Signatures},{Apache/NCSA HTTP Server Signatures},asm50=40622,asm52=200000028,asm53=Unix hidden (dot-file) access,asm54={Unix/Linux Signatures},asm55=,asm61=,asm62=,asm63=8985143867830069446,asm64=example-waf.example.com,asm65=/.htaccess,asm67=Attack signature detected,asm68=<?xml version='1.0' encoding='UTF-8'?><BAD_MSG><violation_masks><block>13020008202d8a-f803000000000000</block><alarm>417020008202f8a-f803000000000000</alarm><learn>13000008202f8a-f800000000000000</learn><staging>200000-0</staging></violation_masks><request-violations><violation><viol_index>42</viol_index><viol_name>VIOL_ATTACK_SIGNATURE</viol_name><context>request</context><sig_data><sig_id>200000028</sig_id><blocking_mask>7</blocking_mask><kw_data><buffer>Ly5odGFjY2Vzcw==</buffer><offset>0</offset><length>2</length></kw_data></sig_data><sig_data><sig_id>200000028</sig_id><blocking_mask>4</blocking_mask><kw_data><buffer>Ly5odGFjY2Vzcw==</buffer><offset>0</offset><length>3</length></kw_data></sig_data><sig_data><sig_id>200100015</sig_id><blocking_mask>7</blocking_mask><kw_data><buffer>Ly5odGFjY2Vzcw==</buffer><offset>1</offset><length>9</length></kw_data></sig_data></violation></request-violations></BAD_MSG>,asm69=5,asm71=/Common/_dev.example.com_SSL,asm75=127.0.0.1,asm100=,asm101=HEAD /.htaccess HTTP/1.1\r\nUser-Agent: curl/7.29.0\r\nHost: dev.example.com\r\nAccept: */*\r\nX-Forwarded-For: 127.0.0.1\r\n\r\n#015
最佳答案
该模式不适用于 fields
group 匹配字符串 field
您正在尝试重复命名组 fields
但示例字符串没有字符串 field
.
备注 那个[^,]
匹配除逗号之外的任何字符,您可以省略命名组中的捕获组 field
因为它已经是一个组和 \w
也匹配 \d
使用 2 个捕获组:
\b(asm[0-9]+)=(.*?)(?=,asm[0-9]+=|$)
\b
一个字边界(asm[0-9]+)
捕获 第 1 组 , 匹配 asm 和 1+ 位数字 =
字面匹配 (.*?)
捕获 第 2 组 , 尽可能匹配任何字符 (?=
正向前瞻,断言右边的是,asm[0-9]+=
匹配 ,asm
后跟 1+ 位数字和 =
|
或 $
断言字符串的结尾 )
关闭前瞻关于regex - 逗号分隔的前缀列表,里面有逗号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66206959/
在我的应用程序中,我使用 scrape(string url) 方法从网页中抓取链接。可以说它每次都返回我 10 个 url。 我想从每个抓取的 url 中抓取 10 个链接。 长话短说: (第 1
正如标题所说,我需要将 php 放入由 php 回显的 javascript 中 例如: if (something) then (some php)') ?> 这不是真正的代码,只是可能有助于理解
我有一个 ng-repeat 使用 ng-switch 来分隔 ng-repeat 内部的部分,我想在 ng-switch 组上应用一个 orderby 过滤器,但我似乎无法让它工作:
我是 shell 的新手。我不太了解以下功能。这个函数基本上把小时加1。 我想知道为什么开发人员在 $g_current_hour+1 前面放了“10#”。根据我的理解,shell 中的剂量 # 是指
为了在 MongoDB 中对元素进行分组和计数,我已经筋疲力尽了。有很多帖子,但没有一个是我需要的。 这是一个基于以下内容的示例: styvane answer db.VIEW_HISTORICO.a
int main() { int count = 0; string prev = " "; string current; while (cin>>current)
$0表示传递给swift闭包的第一个参数,是swift语言的语法糖。swift会自动为内联闭包提供速记参数名称,可使用$0,$1,$2等名称来引用闭包参数的值。 代码
我想把这个 If 放在宏中,但它总是给我一个错误。我不知道“或”用得是否正确。 Dim SMAT As String SMAT = "blahblahblah" (...) If Ce
这是 JSFiddle 链接:https://jsfiddle.net/fmdsu9Lo/ 我想添加一个悬停功能,以便将鼠标悬停在菜单上将在该菜单选项卡上应用 .current 样式,同时将其从当前打
是否可以在 SQL 中执行类似的操作? SELECT SUM(jobRequirements.number) as total, SUM(jobRequirements.number WHER
我有 3 个 SQL 表。 游戏 wo_tenis_partidos 选择 wo_tenis_pronosticos 配额 wo_tenis_cuotas_ha2 我需要获取满足两个条件的所有行: 条
我有这张乘客表日期: 这意味着在 Reservation 000004 中,有两个行程,分别是 Itinerary 0000010 (AAC Hangar - Anvaya Cove) 和 00000
里面
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 已关闭 9 年前。 此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-topic在这里
我在模态框内显示一个弹出窗口,我可以在关闭时隐藏它,但在点击模态框外时无法隐藏它。我试着在关闭时隐藏它,这很好。代码在这里 $('.close, .close-button').click(funct
我所在的团队正在使用 MVC 架构开发 C# 程序。 当我完成 MVC 教程时,我有一些疑问。请帮我澄清一下这个疑惑。 1) Controller 可以对 View 进行哪些修改? 2)我认为所有 U
我正坐在一些通过#defines 生成大量代码的遗留代码上。现在我知道在 #define 中不可能有 #ifdef,但是 #if 可能吗?我想为特定类型添加一些特化。 (无需进行重大更改,例如使用模板
这是我试图用来创建触发器的代码: -- Dumping structure for trigger kavanga_lead.click_links_insert DROP TRIGGER IF EX
我想写这样的东西: #define COV_ON(x) \ #ifdef COVERAGE_TOOL \ _Pragma (CO
我在这样的定义的帮助下初始化一个结构数组: #define FLAGCODE(name) { #name, MNT_ ## name } struct { const char
我尝试将 css 和 jquery 应用于 div 元素,但它不接受 $(this) 参数。我想知道为什么我不能使用 $(this) 作为 div 元素的引用。 blabla.css({ 'top':
我是一名优秀的程序员,十分优秀!