Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use regular expressions to automatically add sql quotation marks in notepad++

Shulou Source: shulou.com Published: 2022-06-02 03:46:49 09月10日 Update

This article is about how to use regular expressions to add sql quotes automatically in notepad++. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

notepad regular expressions add sql quotes

General sql statements are often used to add quotation marks to the contents of parentheses. sql is as follows

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

At first, I referred to a method that I didn't think was very good to use. After a bit of research, it should be possible to implement regular expressions.

Let's see how notepad++ automatically adds quotes.

Step 1:

First enter the following data format (usually copy and paste it), remember to delete the blank line oh, otherwise there will be an extra line (single) double quotation marks.

25001510153394032

25001510153394034

25001510153393963

25001510153392080

25001510153392079

25001510153393964

In notepad++ menu bar macro, click Start Record, then press Ctrl+f, switch to the Replace tab, select the regular expression, enter ^in the Replace target, replace with what you want to replace (I entered 'here), then click Replace All, replace the beginning and then replace the end, enter ¥ in the Replace target, replace with what you want to replace (I entered' here), and then click Replace All. Go back to macro, click stop recording, then save macro, set shortcut key, enter the name of macro (usually named with function), save. Later you can use this shortcut key to complete the automatic quotation marks added function.

Screenshots are as follows:

The final effect is as follows:

Thank you for reading! About "Notepad++ how to use regular expressions to automatically add sql quotes" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Quotation marks regularities expressions content input functions shortcuts more goals articles references good practical line name beginning screenshots parentheses effects data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno NVidia Docker Shulou Tech Info Redmi