Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Verify that an evaluation output matches a given pattern and produces no errors
ResourceFunction["CheckMatch"][eval,patt,fail] returns the output of eval if it matches patt and generates no messages and fail otherwise. | |
ResourceFunction["CheckMatch"][eval,patt] uses $Failed as the failure expression. |
| "FailOnMessage" | True | stop the evaluation and return the failure expression as soon as a message occurs |
| "RetryCount" | 0 | how many times to retry the evaluation if it fails |
| "RetryWait" | 0 | how long to wait before retrying |
| "Quiet" | {} | messages to ignore |
| "Message" | False | print a message if pattern does not match |
Check an evaluation to make sure its output matches a pattern:
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= |
Give an expression to return on failure:
| In[3]:= |
| Out[3]= |
| In[4]:= |
The output is returned if no messages are generated and it matches the supplied pattern:
| In[5]:= |
| Out[5]= |
The third argument is returned if the output does not match:
| In[6]:= |
| Out[6]= |
If any message occurs during the evaluation, the third argument is returned:
| In[7]:= |
| Out[7]= |
Retry an evaluation if it fails:
| In[8]:= |
| Out[9]= |
Wait before attempting retries:
| In[10]:= | ![]() |
| Out[11]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License