vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   MySQL REGEX Query (https://vborg.vbsupport.ru/showthread.php?t=161299)

BamaStangGuy 10-28-2007 07:49 AM

MySQL REGEX Query
 
I am running this query:
PHP Code:

        $result_date $vbulletin->db->query_read("
                        SELECT DISTINCT
                        z.tag, COUNT(*) AS total_lyrics
                        FROM " 
TABLE_PREFIX "zoints_tag AS z
                        LEFT OUTER JOIN " 
TABLE_PREFIX "thread AS t
                        ON z.threadid = t.threadid
                        WHERE t.forumid = 34 AND z.tag REGEXP '^[0-9]'
                        GROUP BY z.tag
                        ORDER BY z.tag
        "
); 

With the goal of retrieving every tag that starts with 0-9. I have one tag in there right now that starts with a 3, '3 doors down'.

However the above query does not return any results. Is that the correct format and if so what would be causing it to return nothing at all?

Marco van Herwaarden 10-28-2007 12:03 PM

'^[0-9]'

This means that the data should start with a single digit number and nothing after that.

try:

'^[0-9].*'

BamaStangGuy 10-28-2007 06:50 PM

I figured it out. I had a misspelling lol.

Thanks for the help though, I did need to adjust the regex.


All times are GMT. The time now is 05:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00990 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete