Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Database/World Building

Development::Database/World Building World Building forum, dedicated to the EQEmu MySQL Database. Post partial/complete databases for spawns, items, etc.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 02-06-2013, 10:58 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default regex hijack

you can also do ridiculous pattern matching against the name field with REGEXP, but you'll end up having to use COLLATE utf8_bin if you want case sensitivity. i'm not sure what the side-effects might be as far as unexpected results with binary collation. i was puttering around with it earlier and stopped when my query started to look like this:

Code:
SELECT
    name, id
FROM
    npc_types
WHERE
    name
REGEXP
    '^[^#]?Familiar|Sum(Air|Earth|Water|Fire)|(Swarm|Pet)[A-Z]'
COLLATE
    utf8_bin;
mysql info on regexp
http://dev.mysql.com/doc/refman/5.1/en/regexp.html

regular expression pattern matching is insanely powerful, but you sometimes end up going insane trying to get your pattern to do exactly what you want it to do. they're not used for anywhere near what they have the power to do in most quest scripts you'll see, as they are normally only in EVENT_SAY for simple (and often incorrect) string matches.

perl re info
http://perldoc.perl.org/perlre.html

here are a couple of gui apps that are handy to use when writing more complex expressions
http://www.weitz.de/regex-coach/
http://www.regexbuddy.com/
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:25 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3