.Net Regex quesion

Started by stanl, June 26, 2018, 07:51:31 AM

Previous topic - Next topic

stanl

Looking like a Regex pattern and .Net Object in WB CLR

Code (WINBATCH) Select

cPattern = "^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$"
ObjectClrOption("useany","System.Net")
oReg = ObjectClrNew('System.Text.RegularExpressions.Regex',cPattern)
oReg.CacheSize = ObjectType("ui2",15)


and using the pattern to loop through thousands of fields in an SQL Recordset.  So assuming the data is consumed in a While...Endwhile loop. I have read that in a loop it may be best to reset the CacheSize back to 0 then back to 15

oReg.CacheSize = ObjectType("ui2",0)
oReg.CacheSize = ObjectType("ui2",15)

But I have also read that for large loops setting RexOptions.Compiled is recommended, but then further reading says it is not available and further/further reading gives examples of setting it when the Regex Object is initiated.

In a test case of about 200 rows the script appeared to work without either of these, but was wondering if anyone had any experience with very large loops and how either of these might be integrated into a WB script.