Title: TypeError: response.match
Last modified: August 22, 2016

---

# TypeError: response.match

 *  Resolved [Rollaz](https://wordpress.org/support/users/rollaz/)
 * (@rollaz)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/typeerror-responsematch/)
 * Hello,
 * when trying to searsh for entered phrase I get an error in firebug console:
 *     ```
       TypeError: response.match(...) is null
       response = response.match(/!!ASPSTART!!(.*[\s\S]*)!!ASPEND!!/)[1];
       ```
   
 * what could cause this?
 * [https://wordpress.org/plugins/ajax-search-lite/](https://wordpress.org/plugins/ajax-search-lite/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733134)
 * Hi!
 * It means, that the ajax response didn’t process or failed with an error 500. 
   It’s usually a fatal error, but it’s extremely hard to tell where it originates.
 * The best way probably is to enable error reporting on the wp-config.php file 
   and check the request for possible errors.
 * If you enable error reporting and you can link me to a page where the search 
   is activa I might be able to see if there is any error returned in the ajax response.
 *  Thread Starter [Rollaz](https://wordpress.org/support/users/rollaz/)
 * (@rollaz)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733187)
 * On POST response I see an error:
 * Fatal error: Call to undefined function mb_convert_case() in /var/www/html/wp-
   content/plugins/ajax-search-lite/includes/search.class.php on line 41
    ([http://mydomain/wp-content/plugins/ajax-search-lite/js/nomin-scoped/asljquery.js?ver=3.8.1](http://mydomain/wp-content/plugins/ajax-search-lite/js/nomin-scoped/asljquery.js?ver=3.8.1))
 * TypeError: response.match(…) is null
    response = response.match(/!!ASPSTART!!(.*[\
   s\S]*)!!ASPEND!!/)[1]; ([http://mydomain/wp-content/plugins/ajax-search-lite/js/nomin-scoped/jquery.ajaxsearchlite.js?ver=3.8.1](http://mydomain/wp-content/plugins/ajax-search-lite/js/nomin-scoped/jquery.ajaxsearchlite.js?ver=3.8.1))
 * And I can not give a link for you, because it is an internal page and it is not
   reachable outside my company.
 * Blind guess: can it be related with jQuery versions or something in php settings?
   I tried the same website and database set up on my local computer with random
   environment (easyPHP server don’t know exactly any PHP ir SQL versions) and search
   worked here as it is.
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733189)
 * Hi!
 * It’s actually something else, luckily there is a very simple fix. The first error
   message indicates that the mbstring module is not loaded in php.ini. It’s responsible
   for various accent/case related tasks with strings.
 * If you open up the **plugins/ajax-search-lite/includes/search.class.php** file
   and go to line 41 where you should see this:
 * `$this->s = mb_convert_case($keyword, MB_CASE_LOWER, "UTF-8");`
 * Try to remove that line completely, or add comments like this:
 * `//$this->s = mb_convert_case($keyword, MB_CASE_LOWER, "UTF-8");`
 * That should solve the issue immediately.
 *  Thread Starter [Rollaz](https://wordpress.org/support/users/rollaz/)
 * (@rollaz)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733190)
 * quick response 🙂
    applied suggested changes – now plugin seems to be working
   but doesn’t find anything. Always returns !!ASPSTART!![]!!ASPEND!! in response.
 *  Thread Starter [Rollaz](https://wordpress.org/support/users/rollaz/)
 * (@rollaz)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733191)
 * Update 🙂
    I inspected more with firebug, with debug turned on. So now in ajax
   response I see database error:
 *     ```
       <p class='wpdberror'><strong>WordPress database error:</strong> [Got error 'empty (sub)expression' from regexp]<br />
       			<code>
           		SELECT
                 wp_posts.post_title as title,
                 wp_posts.ID as id,
                 wp_posts.post_date as date,
                 wp_posts.post_content as content,
                 wp_posts.post_excerpt as excerpt,
                 wp_users.user_nicename as author,
                 CONCAT('--', GROUP_CONCAT(DISTINCT wp_terms.term_id SEPARATOR '----'), '--') as ttid,
                 wp_posts.post_type as post_type,
                 ((case when
                       (lower(wp_posts.post_title) REGEXP 'Array')
                        then 10 else 0 end) + (case when
                       (lower(wp_posts.post_title) REGEXP '')
                        then 10 else 0 end) + (case when
                       (lower(wp_posts.post_content) REGEXP 'Array')
                        then 7 else 0 end) + (case when
                       (lower(wp_posts.post_content) REGEXP '')
                        then 7 else 0 end)) as relevance
           		FROM wp_posts
               LEFT JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID
               LEFT JOIN wp_users ON wp_users.ID = wp_posts.post_author
               LEFT JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
               LEFT JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
               LEFT JOIN wp_terms ON wp_term_taxonomy.term_id = wp_terms.term_id
   
           	WHERE
                       (wp_posts.post_type REGEXP '[[:<:]]post[[:>:]]|[[:<:]]page[[:>:]]')
                   AND (lower(wp_posts.post_status) REGEXP 'publish')
                   AND (( lower(wp_posts.post_title) LIKE '%%' ) OR ( lower(wp_posts.post_content) LIKE '%%' ))
                   AND (wp_posts.ID NOT IN (-55))
               GROUP BY
                 wp_posts.ID
   
                 ORDER BY relevance DESC, wp_posts.post_date DESC
               LIMIT 10</code></p>
       			</div>!!ASPSTART!![]!!ASPEND!!
       ```
   
 * I guess it’s because of that commented line.
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733192)
 * Oh of course!
 * My mistake. As you can see from the query, the keyword is not present.
    So instead
   of disabling that previously mentioned line, modify it simply to this:
 * `$this->s = $keyword;`
 * Or, if you want to make sure it’s lowercase:
 * `$this->s = strtolower($keyword);`
 * That will possibly solve the issue.
 *  Thread Starter [Rollaz](https://wordpress.org/support/users/rollaz/)
 * (@rollaz)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733193)
 * Yes, that was the problem 🙂 Search now is working. Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘TypeError: response.match’ is closed to new replies.

 * ![](https://ps.w.org/ajax-search-lite/assets/icon-256x256.png?rev=3192672)
 * [Ajax Search Lite - Live Search & Filter](https://wordpress.org/plugins/ajax-search-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-search-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-search-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-search-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-search-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-search-lite/reviews/)

## Tags

 * [typeerror](https://wordpress.org/support/topic-tag/typeerror/)

 * 7 replies
 * 2 participants
 * Last reply from: [Rollaz](https://wordpress.org/support/users/rollaz/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/typeerror-responsematch/#post-5733193)
 * Status: resolved