There are segments in the below-mentioned string. Each segment is started with a tilt(~) sign and I want to check if there exists a segment in which the AAA segment appears and on its 3rd index a number 63 is present.
ISA*ABC**TODAY*ALEXANDER GONZALEZ~HL*CDD*DKKD*S~EB*1*AKDK**DDJKJ~AAA*Y**50*P~AAA*N**50*P~AAA*N**63*C~AAA*N**50*D~AAA*N**45*D
I want to do it with a regular expression to avoid lengthy coding. I have tried and come up with this (~AAA)
to check if this segment exists or not but because I am new to regular expressions I don't know how to check if 63 appears on the 3rd index or not? If anyone can help I will be very thankful.