It is a common and good practise in filters to perform a quick and cheap precheck prior starting up the regex which is slower.
In your case, let me suggest to do a simple strpos() check to see if a substring data-app-link is even present in the text, and if not (which is majority of cases), return early from the filter_applink::filter() method.
It is a common and good practise in filters to perform a quick and cheap precheck prior starting up the regex which is slower.
In your case, let me suggest to do a simple
strpos()
check to see if a substringdata-app-link
is even present in the text, and if not (which is majority of cases), return early from thefilter_applink::filter()
method.