0

I have string with me :

Strings are:

"Receiving datame2->$@<CTR>&CTData=<G><TT>d</TT>00<X>Approved</CTR>" **should match**

"Receiving datame2->$@<CTR>&CTData=<G><R>^@^<T>0Y<X>Approved</CTR>" **should not match**

I would like to write regex that do match the

Receiving datame2(alltextin between)CTR(alldata in between)G(alldata in between)00(rest all data)

And .vice verse other then this should be rejected.

can i have to 2 Regular expression one for accepting and other one for rejecting the data. Other then this.

4

1 回答 1

0

试试这个来匹配你问题中的第一个例子。第二个示例将使用相同的正则表达式自动拒绝。

Receiving datame2[^<]+<CTR>[^<]+<G>.+(?=00).+

描述

正则表达式可视化

演示

http://regex101.com/r/bE3pZ3

于 2014-01-17T10:18:14.910 回答