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, 2022 in Database by Neha
• 9,020 points
1,670 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, 2022 by Vaani
• 7,070 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, 2022 in Database by Neha
• 9,020 points

edited Feb 17, 2022 by Neha 19,326 views
0 votes
1 answer

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

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

answered Feb 21, 2022 in Database by Neha
• 9,020 points
726 views
0 votes
0 answers

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

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

Feb 22, 2022 in Database by Vaani
• 7,070 points
640 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, 2022 in Database by gaurav
• 23,260 points
1,013 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, 2022 in Others by polo
• 1,480 points
345 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
1,856 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,020 points
2,082 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, 2022 in Database by Vaani
• 7,070 points
831 views
0 votes
1 answer

What is an index in SQL?

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

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