How to get a substring If the Regex IsMatch value is TRUE from the lenghty string in dynamics ax 2012

Many Thanks In Advance

Hi Every One,

I want to get a string If the Regex IsMatch is TRUE. For Example , Please check below code which I have used,

System.Text.RegularExpressions.Regex re;



Permission =

new InteropPermission(InteropKind::ClrInterop);


re = new System.Text.RegularExpressions.Regex("([0-9])+([a-zA-Z]+[a-zA-Z]+[a-zA-Z]+[a-zA-Z])+([0-9]+[0-9]+[0-9]+[0-9]+ [0-9]+[0-9]+[0-9])+([a-zA-Z])");

str sampleString = “ABCD_SAMPLE_14ABCD1234567B.xml”;

retVal = CLRInterop::getAnyTypeForObject(re.IsMatch(sampleString));

In this Program If the Return value is True or 1, I need to get this value (14ABCD1234567B) as a string.

If anybody knows this, Please help me.

you will be appreciated…

Thanks in Advance…

IsMatch() returns true or false, nothing else. Use Match() (or another suitable method) instead.