Results 1 to 5 of 5

Thread: Regular expression in MySQL

  1. #1
    Join Date
    Nov 2008
    Posts
    240

    Regular expression in MySQL

    I am doing an database course from an institution and I am so much related to this forums.I solved so many questions with the help of you all.I need some more help regarding the regular expressions in the mysql database.would you give me some more information about this topic.

    Thanks.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Regular expression in MySQL

    Regular expression

    Regular Expressions in very important features of MySQL database which is used in the REGEXP and RLIKE segment of WHERE clauses in the select statement .It is used to perform the selection of records to display, update and delete operation.

    The where clause contains the different sections for different operations.every segments contains different operators for different operation.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    REGEXP Operator in MySQL

    The use of regular expressions in Mysql is very limited but much useful. MySQL Introduces with only one operator which grant you to work with regular expressions. The operator is called REGEXP operator which performs same as the LIKE operator.

    It doesn't use _ and % wildcards characters ,it follows the POSIX Extended Regular Expression (ERE).

    The major difference between the LIKE and REGEXP is that the LIKE operator evaluates True if the pattern get similar for the whole string.Where as ,The WHERE testcolumn REGEXP 'jg' evaluates all rows where testcolumn has jg within the whole string.

  4. #4
    Join Date
    Apr 2008
    Posts
    1,948

    Types of operators with REGEXP in MySQL

    Types of operators

    There are different operators comes under the Regexp operator.It contains the following operators-

    1- Literal Characters Match a character exactly
    2- Anchors and assertions
    3- Character groups any 1 character from the group
    4- Counts apply to previous element
    5- Alternation
    6- Grouping

    These are the types of category for operators in MySQL database which contains more operators as a hierarchy of operators.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Examples of REGEXP in MySQL

    I am going to show you some example which is used with the different operators and attached with the REGEXP section.

    With Anchors and assertions operators:

    1) ^ operator - Match the beginning of a string.

    Code:
    mysql> SELECT 'fo\nfo' REGEXP '^fo$';                   -> 0
    mysql> SELECT 'fofo' REGEXP '^fo';                      -> 1

    2) $ operator - Match the end of a string.

    Code:
    mysql> SELECT 'fo\no' REGEXP '^fo\no$';                 -> 1
    mysql> SELECT 'fo\no' REGEXP '^fo$';                    -> 0

Similar Threads

  1. Using Regular Expression than Substring in Microsoft Excel
    By Jigisha in forum MS Office Support
    Replies: 5
    Last Post: 25-01-2012, 06:19 PM
  2. Replies: 4
    Last Post: 13-01-2011, 01:08 AM
  3. Regular expression Help in asp.net for DOB.
    By maheshmartha in forum Software Development
    Replies: 2
    Last Post: 06-03-2010, 07:06 AM
  4. Regular expression in Perl
    By Ameeryan in forum Software Development
    Replies: 2
    Last Post: 19-11-2009, 02:07 PM
  5. Replies: 3
    Last Post: 07-11-2009, 09:36 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,695,678.55922 seconds with 17 queries