正则表达式在 RAD 软件中不起作用

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

我在 rad 软件正则表达式中使用下面的正则表达式和组名单独工作正常但是当我将它们组合在一起时 - 分组行为不当

regex1 -

Throughput\s*\|(?<T1>[\d\.]+(?:\s+\w+))

regex2 -

Connection rate\s*\|(?<T2>\s*[\d\.]+(?=\s*\|))

个人都给一个组名的比赛

当我像下面这样组合它们时

(Throughput\s*\|(?<T1>[\d\.]+(?:\s+\w+)))|(Connection rate\s*\|(?<T2>\s*[\d\.]+(?=\s*\|)))

这是给2场比赛 找不到第一场比赛 T2 组 找不到第 2 场比赛 T1 组

但是为什么在第一场比赛中它的测试T2组不确定

下面是我的字符串

i am using below regex with group name in rad software which is working fine individually but when i combine them - grouping misbehaves

reg1 - Throughput\s*\|(?<T1>[\d\.]+(?:\s+\w+))
regex2 - Connection rate\s*\|(?<T2>\s*[\d\.]+(?=\s*\|))

individual both are giving one match with1 group name

when i combine them like below
(Throughput\s*\|(?<T1>[\d\.]+(?:\s+\w+)))|(Connection rate\s*\|(?<T2>\s*[\d\.]+(?=\s*\|)))

**which is giving 2 match** 
1st match T2 group not found
2nd match T1 group not found

but why in 1st match its testing T2 group not sure

Below is my string

Sun Feb 19 15:08:35 IST 2023                                                                                                                                                               
Aggregated statistics (IPv4 Only) of SGMs: chassis_active VSs: 0                                                                                                                           
+--------------------------------------------------------------+                                                                                                                           
|Performance Summary                                           |                                                                                                                           
+----------------------------------------------+---------------+                                                                                                                           
|Name                                          |Value          |                                                                                                                           
+----------------------------------------------+---------------+                                                                                                                           
|Throughput                                    |34.0 K         |                                                                                                                           
|Packet rate                                   |66             |                                                                                                                           
|Connection rate                               |0              |                                                                                                                           
|Concurrent connections                        |34             |                                                                                                                           
|Load average                                  |12%            |                                                                                                                           
|Acceleration load (avg/min/max)               |2%/2%/2%       |                                                                                                                           
|Instances load (avg/min/max)                  |14%/14%/16%    |                                                                                                                           
|Memory usage                                  |17%            |                                                                                                                           
+----------------------------------------------+---------------+                                                                                                                           
 * Instances / Acceleration Cores: 4 / 2                                                                                                                                                   
 * Activated SWB: FW                                                                                                                                                                       
+------------------------------------------------------------------------------+                                                                                                           
|Per Path Distribution Summary                                                 |                                                                                                           
+------------------+--------------+--------------+--------------+--------------+                                                                                                           
|                  |Acceleration  |Medium        |Firewall      |Dropped       |                                                                                                           
+------------------+--------------+--------------+--------------+--------------+                                                                                                           
|Throughput        |0             |0             |34.0 K        |0             |                                                                                                           
|Packet rate       |0             |0             |66 K            |0             |                                                                                                           
|Connection rate   |0             |0             |0             |              |                                                                                                           
|Concurrent conn.  |0             |0             |34            |              |                                                                                                           
+------------------+--------------+--------------+--------------+--------------+                                                                                                           
                                                                                                                                                                                           

regex regex-group rad qregularexpression
© www.soinside.com 2019 - 2024. All rights reserved.