Method RegEx():precompile() Foundation
Forces immediate pattern compilation.
:precompile() --> lSuccess
.T. (true) if compilation is successful, .F. (false) on error.
Compiles the pattern assigned to the RegEx object immediately instead of waiting for the first use. This can be useful to validate patterns early or to move the compilation cost outside of performance-critical sections.
After compilation, the method :optimize() can be used to improve the speed of pattern execution.
Precompile
oRegEx := RegEx():create("^[A-Z]+$")
IF !oRegEx:precompile()
? "Invalid pattern: " + oRegEx:getLastMessage()
ENDIF
// Use oRegEx
oRegEx:destroy()
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.