#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    17
    Rep Power
    0

    Equivalance class


    Hi,

    my version is as follow:

    Code:
    mysql> show variables where variable_name like '%version%';
    +-------------------------+------------------------------+
    | Variable_name           | Value                        |
    +-------------------------+------------------------------+
    | innodb_version          | 5.5.32                       |
    | protocol_version        | 10                           |
    | slave_type_conversions  |                              |
    | version                 | 5.5.32                       |
    | version_comment         | MySQL Community Server (GPL) |
    | version_compile_machine | x86_64                       |
    | version_compile_os      | Linux                        |
    +-------------------------+------------------------------+
    7 rows in set (0.01 sec)

    I'm trying to figure out what does equivalence class means.

    with reference to http://dev.mysql.com/doc/refman/5.5/en/regexp.html

    Within a bracket expression (written using [ and ]), [=character_class=] represents an equivalence class. It matches all characters with the same collation value, including itself. For example, if o and (+) are the members of an equivalence class, [[=o=]], [[=(+)=]], and [o(+)] are all synonymous. An equivalence class may not be used as an endpoint of a range.
    Code:
    mysql> SELECT 'o+' REGEXP '[[=o=]]';
    +-----------------------+
    | 'o+' REGEXP '[[=o=]]' |
    +-----------------------+
    |                     1 |
    +-----------------------+
    1 row in set (0.00 sec)
    2nd example

    Code:
    mysql> SELECT 'o+' REGEXP '[[=(+)=]]';
    ERROR 1139 (42000): Got error 'invalid collating element' from regexp
    mysql> SELECT 'o+' REGEXP '[[=(+)=]]';
    ERROR 1139 (42000): Got error 'invalid collating element' from regexp
    mysql>
    what's wrong with the 3rd example?
    Code:
    mysql> SELECT 'o+' REGEXP '[[=o=]], [[=(+)=]]';
    ERROR 1139 (42000): Got error 'invalid collating element' from regexp
    mysql>
    what's wrong with my implementation?

    What does equivalence class mean?

    any examples?

    thanks a lot!
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    o and (+) are meant to represent individual characters. Not literally "o" and "(+)".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    17
    Rep Power
    0
    would appreciate if you could give examples so that I can learn better?

    thanks
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398
    [[=any one character you want in here=]], like
    Code:
    [[=o=]]
    [[=(=]]
    [[=+=]]
    [[=)=]]

IMN logo majestic logo threadwatch logo seochat tools logo