- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Search text containing a new line in MySQL?
You can use REGEXP. Let us first create a table −
mysql> create table DemoTable ( Name varchar(100) ); Query OK, 0 rows affected (1.61 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('John
Smith'); Query OK, 1 row affected (0.73 sec) mysql> insert into DemoTable values('John Doe'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('David
Miller'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values('Carol Taylor'); Query OK, 1 row affected (0.27 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+--------------+ | Name | +--------------+ | John Smith | | John Doe | | David Miller | | Carol Taylor | +--------------+ 4 rows in set (0.00 sec)
Here is the query to search text containing a new line in MySQL −
mysql> select *from DemoTable where Name regexp "
";
This will produce the following output −
+--------------+ | Name | +--------------+ | John Smith | | David Miller | +--------------+ 2 rows in set (0.41 sec)
- Related Articles
- Using XPATH to search text containing  
- Text manipulation of strings containing “The ”? in MySQL
- Search for a string within text column in MySQL?
- Search for text between delimiters in MySQL?
- Remove new line characters from rows in MySQL?
- Set search feature in MySQL for full text searching
- Update all rows by prefixing a line to every text in MySQL?
- Implement Text search in MongoDB
- Display custom text in a new column on the basis of null values in MySQL?
- Using a regex with text search in MongoDB
- Search for PHP array element containing string?
- Search for a text in MongoDBs Double Nested Array?
- MySQL query for text search with LIKE and OR to fetch records
- Adding default search text to search box in HTML with JavaScript?
- MySQL query to SELECT rows with LIKE and create new column containing the matched string?

Advertisements