I think I found a bug in the recently added Regex library. Let's say we want a specific string from an AT string:
Debug.GC(true); // Force garbage collect var regex = new Regex("\\+CUSD: 2,\"(.*?)\",0$"); // Our regular expression var match = regex.Match("+CUSD: 2,\"Lorem ipsum dolor sit amet...\",0"); // The AT string if (match.Success) { Debug.Print(match.Groups[1].Value); // Print the result of the match }
Debug.Print will correctly print: Lorem ipsum dolor sit amet...
But now the AT string is larger, let's say:
var match = regex.Match("+CUSD: 2,\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...\",0");
When executed the output will say: "Failed allocation for 57 blocks, 684 bytes" and the string in match.Groups[1].Value is corrupted.
As you can see I force the garbage collector to run to ensure the full 40K RAM is available. Any ideas?