Question

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.

Était-ce utile?

La solution

Try this for matching the first example in your question. The second example will be automatically rejected with the same regular expression.

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

Description

Regular expression visualization

Demo

http://regex101.com/r/bE3pZ3

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top