Classic Jhumka Earrings Silver INR 113.00 Free Shipping Buy Now
Black Jhumka Earrings & Studs INR 94.00 Free Shipping Buy Now
Classic Jhumka Earrings Silver INR 207.00 Free Shipping Buy Now
Beautiful stud earing INR 93.00 Free Shipping Buy Now
Different Size Hoop and Stud Earrings Set INR 243.00 Free Shipping Buy Now
Golden Hoop Earing INR 70.00 Free Shipping Buy Now
Home Questions & Answers Technology MySQL Question Answers What is the usage of regular expressions in MySQL?

    What is the usage of regular expressions in MySQL?

  • In MySQL, regular expressions are used in queries for searching a pattern in a string.

    • * Matches 0 more instances of the string preceding it.
    • + matches 1 more instances of the string preceding it.
    • ? Matches 0 or 1 instances of the string preceding it.
    • . Matches a single character.
    • [abc] matches a or b or z
    • | separates strings
    • ^ anchors the match from the start.
    • "." Can be used to match any single character. "|" can be used to match either of the two strings
    • REGEXP can be used to match the input characters with the database.

    Example:

    The following statement retrieves all rows where column employee_name contains the text 1000 (example salary):

     
    1. Select employee_name  
    2. From employee  
    3. Where employee_name REGEXP '1000'  
    4. Order by employee_name