
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What are the different wildcard characters that can be used with MySQL RLIKE operator?
The use of wildcards with RLIKE operators can save a lot of effort when we write a query that looks for some pattern (regular expression) in character string. The wildcards used with RLIKE are:
^ − It signifies BEGINING of the string. In other words when we use this wildcard with RLIKE operator then it will find the pattern that begins with the particular string written after ^ wildcard
Example
mysql> Select Id, Name from Student WHERE Name RLIKE '^H'; +------+---------+ | id | Name | +------+---------+ | 15 | Harshit | +------+---------+ 1 row in set (0.00 sec)
$ − It signifies END of the string. In other words when we use this wildcard with RLIKE operator then it will find the pattern that ends with the particular string written after $ wildcard.
Example
mysql> Select Id, Name from Student WHERE Name RLIKE 'v$'; +------+--------+ | Id | Name | +------+--------+ | 1 | Gaurav | | 2 | Aarav | | 20 | Gaurav | +------+--------+ 3 rows in set (0.00 sec)
| −It means OR. In other words when we use this wildcard with RLIKE operator then it will find the string which will have either substring written with | wildcard.
Example
mysql> Select Id, Name from Student WHERE Name RLIKE 'Gaurav|raj'; +------+---------+ | Id | Name | +------+---------+ | 1 | Gaurav | | 20 | Gaurav | | 21 | Yashraj | +------+---------+ 3 rows in set (0.00 sec)
- Related Articles
- What are the different wildcard characters that can be used with MySQL LIKE operator?
- What are the different wildcard characters which can be used with NOT LIKE operator?
- How wildcard characters can be used with MySQL CONCAT() function?
- What are the different unit values that can be used with MySQL INTERVAL keyword?
- What is the use of RLIKE operator in MySQL?
- What are the different time format characters used by MySQL DATE_FORMAT() function?
- What are different date format characters used by MySQL DATE_FORMAT() function?
- What are the different commands used in MySQL?
- How can Tensorflow be used with Fashion MNIST dataset so that the trained model is used to predict a different image in Python?
- How can CONCAT() function be used with MySQL WHERE clause?
- How can CONCAT_WS() function be used with MySQL WHERE clause?
- How LOCATE() function can be used with MySQL WHERE clause?
- How can MySQL REPLACE() function be used with WHERE clause?
- Why BINARY keyword used with MySQL REGEXP operator?
- Can a diamond operator be used with an anonymous inner class in Java 9?

Advertisements