tom000.info - Logo
  • News
  • About Me
  • Your Account
  • Polski/Polish
  • Contact
Menu
  • News
  • Portfolio
  • Publications
  • jMPD
  • Gallery
  • Polski/Polish
  • Contact
New articles
  • Framebuffer in Linux
  • MySQL - Transactions
  • MySQL - Regular expressions
  • MySQL - Date processing functions
Online
Visitors: 3
MySQL - Regular expressions

Author: tom000
Date: 2007-03-06 17:19:59

Regular expressions give us more possibilities in scope of searching records in database. They offer much of flexibility while searching pattern and serve to precise describe sequence of chars. They can be found in majority of programing languages and also in databases. MySQL database has this possibility too. Sequence of chars can be characterized by some meta-chars.

Meta-chars of regular expressions for MySQL


Although many languages lets to use regular extensions that, this chars can be used for specified programing languages. Here is list of chars for MySQL.


  • . - any char
  • ^ - begin of sequence
  • $ - end of sequence
  • [...] - any char form collection (...)
  • [^...] - any char from out of collection (...)
  • [:k:] - any char from class k
  • a* - number of appears char a is 0 or more
  • a+ - number of appears char a is 1 or more
  • a? - number of appears char a is 0 or 1
  • a{5} – number of appears char a is 5
  • a{1,5} – number of appears char a is between 1 and 5
  • a{5,} - number of appears char a is 5 or more
  • a|b – appear char a or b
  • (...) - define of store extension


To inform MySQL database about use in query regular extensions should be used command REGEXP. MySQL database doesn't distinguish chars size inside query, so decision about using small caps or all caps while creating query depends on user. There are some cases when char to find is a part of regular extension (ex. Searching char [). In this case before use of char should be added symbol \ (ex. \[).


« [1] 2 »

Comments

Add comment

Login :
Website :
Comment :
Image text :
Popular tags

browsers desktop directfb errors fbi framebuffer gallery graphic java jmpd kate linux mplayer mysql php portfolio private projects regexp software tests uml version vesa video windows

Other

Valid XHTML 1.1

Some Rights Reserved logo

statystyki www stat.pl

Copyleft (C) tom000.info 2004-2008. Some rights reserved