简体   繁体   English

具有if条件和if then else条件的正则表达式

[英]Regular Expression with if Condition and if then else condition

How can i solve and use this condition in regular Expression if (cond) then s1 else s2. 如果(cond)则s1否则s2如何在正则表达式中求解和使用此条件。 if (cond1)then if (cond) then s1 else s2. 如果(cond1),则如果(cond),则s1否则为s2。 please help me 请帮我

Basically first you give a group a name - for example (?<grp1>match) . 基本上,首先给一个组起一个名字-例如(?<grp1>match)

Now we have a group named 'grp1', that matched the word 'match'. 现在我们有了一个名为“ grp1”的组,该组与单词“ match”匹配。

Then we can subsequently probe if this group has matched with (?(R&grp1)yes|no)) which means if grp1 has been matched continue to see if 'yes' now matches otherwise see if 'no' matches. 然后,我们可以随后探查该组是否与(?(R&grp1)yes|no))匹配,这意味着grp1是否已匹配,请继续查看“ yes”现在是否匹配,否则查看“ no”是否匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM