two back slash in SQL procedure with Regular expression

0 votes

I'm working on a SQL procedure where i came across a Regular expression which contains this piece -

REGEXP '\\s*count\\s*\\('

I do not understand why there are two backslash ? what can be inferred from this code?

Feb 2 in Database by Neha
• 8,560 points
189 views

1 answer to this question.

0 votes
It's the escape prefix in regular expressions: it makes special characters like . and ( be treated literally, and is used to created escape sequences like \s (which means any whitespace character).

But it's also the escape prefix in string literals, used for things like \n (newline) and \b (backspace). So in order for the regular expression character to get a literal backslash, you need to escape the backslash itself.

This is common in many programming languages, although a few have "raw string literals" where escape sequences are not processed, specifically to avoid having to double the slashes so much.
answered Feb 2 by Vaani
• 7,020 points

Related Questions In Database

0 votes
1 answer

Function vs. Stored Procedure in SQL Server

Functions are calculated values that cannot make ...READ MORE

answered Feb 17 in Database by Neha
• 8,560 points

edited Feb 17 by Neha 165 views
0 votes
1 answer

What is "with (nolock)" in SQL Server?

Using READ UNCOMMITED as a transaction isolation ...READ MORE

answered Feb 21 in Database by Neha
• 8,560 points
62 views
0 votes
0 answers

What is "with (nolock)" in SQL Server?

Can someone explain the ramifications of using ...READ MORE

Feb 22 in Database by Vaani
• 7,020 points
98 views
0 votes
1 answer

How can we achieve excel ceiling function with significance value in SQL Server

If the underlying data types and rounding ...READ MORE

answered Apr 4 in Database by gaurav
• 13,560 points
46 views
0 votes
0 answers

Two Backslash in SQL procedure with regular expression

On SQL procedure where i saw a Regular ...READ MORE

May 26 in Others by polo
• 1,500 points
18 views
0 votes
1 answer

Want a command to be executed in Salt only if a directory is empty

You should consider using this inside your ...READ MORE

answered Jun 12, 2018 in DevOps Tools by Damon Salvatore
• 5,980 points
649 views
0 votes
1 answer

Creating A New MySQL User In Amazon RDS Environment

AWS RDS security groups documentation (a common ...READ MORE

answered Jul 18, 2018 in AWS by Priyaj
• 58,080 points
1,368 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3 in Database by Vaani
• 7,020 points
57 views
0 votes
1 answer

What is an index in SQL?

An index is used to speed up ...READ MORE

answered Feb 3 in Database by Vaani
• 7,020 points
41 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP