notepad++ the technique of automatically adding SQL quotes with regular expressions--regular expressions

Source: Internet
Author: User

Notepad regular expression Add SQL quotes, please read the details below.

General SQL statements often use quotes in parentheses to add the following SQL

Select * from
 Test
 Where Id in (' 25001510153394032 ',
  ' 25001510153394034 ', '
  25001510153393963
  ', ' 25001510153392080 ',
  ' 25001510153392079 ', '
  25001510153393964 ');

I started by referring to the Http://www.jb51.net/article/73608.htm method, which I found to be less useful. In the study, it should be possible to use regular expressions to implement.

Let's see how to get notepad++ to automatically add quotes.

Step 1,

First input the following data format (usually copy and paste it), remember to delete the blank line Oh, otherwise there will be a line (single) double quotes.

25001510153394032
25001510153394034
25001510153393963
25001510153392080
25001510153392079
25001510153393964

At the macro at the notepad++ menu bar, click Start Recording, then press CTRL+F, switch to the Replacement tab, select Regular expression, and enter ^ at the replacement target. Replace with replace with the content you want to replace (I entered here is '), then replace all the points, replace the end after the beginning, replace the ending, enter the ¥ at the replacement target, replace the replacement with the content you want to replace (I entered here is ',), and then click Replace All. Back to the macro, click Stop Recording, then save the macro, set the shortcut key, enter the name of the macro (generally named after the function), save. You can then use this shortcut to complete this automatic quote-adding function.

Screenshot below:

The final effect is as follows:

Summary: Like this neatly formatted data, priority thinking is handled with regular expressions and is not limited to notepad++, which supports macros, and regular expressions can be used.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.