Exiting matchChunk() gracefully with invalid regex entry
Posted: Thu Nov 22, 2018 9:45 am
I have a handler that takes regex input from a user and uses it to find text in a field. The user puts a regex in a box. This is the_search. In a handler I have:
The first line puts in the parenthesis so I can find the position of the item found.
The problem arises when the user puts in an invalid regex, e.g. abc [0. I get an execution error at matchChunk. I want something to simply exit the handler if there is erroneous entry. Any ideas pls?
Code: Select all
put "(" & the_search & ")" into the_search
get matchChunk(fld "text", the_search, the_start, the_end)
The problem arises when the user puts in an invalid regex, e.g. abc [0. I get an execution error at matchChunk. I want something to simply exit the handler if there is erroneous entry. Any ideas pls?