Detailed explanation of the search function of notepad++
The following tutorial column will introduce you to the search function of notepad. I hope it will be helpful to friends who need it! notepad
Search function (regular expression)
When you see this, you will definitely think there is something to learn from this! Haha, yes, the above contents are common sense that everyone knows. However, as you can see from the picture above, notepad supports three search modes:
Normal mode
- Extended mode
- Regular expression mode
- regular expression mode of notepad, like His name is the same. This mode supports regular expression search. Once we are familiar with the use of regular expressions, I believe you will fall in love with this feature of using notepad.
Commonly used expressions
Listed below are some commonly used regular expression matching symbols for the convenience of students to find and learn.
Marking and grouping The above symbols are for one character or for repeating one character, however, if What should I do if there are multiple characters? We need to use grouping. Regarding grouping, we can use parentheses Careful students will surely find that in addition to the search function supporting regular expressions, notepad's replacement function also supports regular expressions. The symbols above are also applicable to substitutions.
Characters
Description
##. Match any character
* Matches the previous character 0 or more times, for example,
ab*
matches "a", "ab" or "abb"
Matches the preceding character 1 or more times, for example,
ab
Matches "ab" or "abb", but not "a"
? Matches the preceding character 0 or 1 time, for example,
ab?
matches "a" or "ab", but not "abb"
{n} Matches the previous character or group n times, for example,
ab{2}c
matches "abbc".
##{m,n }
ab{2,3}c Matches the previous character or group, at least m times and at most n times (if n is empty, it means any number of times), for example,
Matches "abbc" or "abbbc"
^
^ a The expression on the right side matches the beginning of a line, for example,
Matches lines starting with "a"
$
z$The expression on the left is matched at the end of a line, for example,
Matches lines ending with "z"
[] ##[^]
[ab] Matches any single character in the list, such as ,
matches "a" or "b";
[0-9]
matches any single number 0-9
\w
Matches any single character except "a" and "b" Matches any single character outside the list, for example,
[^ab]
\W
matches a single character, including underscores, equivalent to
[A-Za-z0-9_]
\d
matches non-single characters, equivalent to
[^A-Za-z0-9_]
\D
matches numeric characters, equivalent to
[0-9]
matches non-numeric characters, equivalent to
[^0-9] ##\b
Matches a word boundary (beginning or end), for example,
\bhe
matches "hello" but not "ahello" \B
Matches non-word boundaries
|
or operator, matches the left or right expression The formula
\s
matches the blank format
\S
Match non-blank characters
\\
Match characters
\
\t
Match Tab character
\r
Match the carriage return symbol
\n
Match the newline symbol
\r\n
Match carriage return and line feed
()
to specify the grouping expression. For example: (abc)?
means matching 0 or 1 abc, here A parenthesized expression is a grouping. Grouping can be divided into two forms, capturing group and non-capturing group. Capturing groups can be numbered by counting their opening brackets from left to right; non-capturing groups are groups that begin with (?) and do not capture text.
Character
Description
(…)
A group of captures. The first group can be accessed via
\1
, the second via \2
.
(?:…)
Non-capturing group.
(?=…)
Non-capturing group – forward assertion. For example,
(.*)(?=ton)
expression, when encountering the 'Appleton' string, will match 'Apple' .
##(? Non-capturing group – backward assertion. For example (? Expression, when encountering the 'sir William' string, the match is 'William'.
(?!…) Non-capturing group – negative forward assertion. For example, the
(?!e)
expression, when encountering 'Apple', will find every letter except 'l', Because it follows 'e'.
(? Non-capturing group – negative backward assertion . For example, (?, when encountering 'sir William', it will match 'William'.
(?P Name the captured group. Submit a name to the group for subsequent use, for example (?PA[^\s ] )\s(?P=first)
will match 'Apple Apple'. Similar to
(A[^\s] )\s\1, but using a group name instead of a number .
(?=name) Matches the group named name.
(?#comment) Comment – Content within brackets will be ignored when matching.
The above is the detailed content of Detailed explanation of the search function of notepad++. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Notepad can be used to record ideas, write code and take notes. 1. Create a new file (Ctrl N), 2. Enter text, 3. Save the file (Ctrl S). It supports a variety of formats and is suitable for beginners and daily use.

The character encoding problem in Notepad can be solved by selecting the correct encoding by selecting the "Save As" function. 1. Open the file, 2. Select "File"->Save As", 3. Select "UTF-8" in the "Encoding" drop-down menu, 4. Save the file. Use advanced editors such as Notepad to handle more complex encoding conversions.

Notepad remains free and open source through user donations. 1) Donations are made through PayPal or bank transfer, and the user voluntarily decides the amount. 2) Funds are used for server fees, development tools and developer bonuses, and transparency is guaranteed through periodic reports. 3) Donations not only support Notepad, but also support the development of the entire open source community.

Notepad does not have built-in autosave function, but can be implemented through scripts or alternative tools. 1. Save Notepad every 5 minutes using PowerShell script. 2. Configure Notepad to enable automatic save. 3. Use VSCode and install the AutoSave plug-in, and set the autosave delay to 10 seconds. Through these methods, data loss can be effectively avoided.

Change the font in Notepad can be achieved through the "Format" menu. The specific steps are as follows: 1. Open Notepad. 2. Click the "Format" menu. 3. Select "Font". 4. Select the font type, size, and style in the dialog box. 5. Click "OK" to save the settings. Through these steps, you can easily personalize the text display of Notepad.

Enable dark mode in Notepad requires modifying the registry settings. The specific steps are as follows: 1. Create and save a file named darkmode.reg, with the contents set by the registry. 2. Double-click the file to import settings, restart Notepad to enable dark mode.

When processing large files, you should use Notepad, command-line tools, or custom scripts. 1.Notepad supports file chunked loading to reduce memory usage. 2. Command line tools such as less or more read files in stream mode. 3. Custom scripts use Python's itertools module to read files iteratively to avoid loading all content at once.

Notepad supports line wrapping, regular expression search, time/date insertion, recovery of closed files and custom fonts and colors. 1) Enable automatic line wrap: Format -> automatic line wrap. 2) Use regular expression search: Ctrl H->Check "Use regular expressions"->Enter regular expressions. 3) Insert the current time and date: F5. 4) Restore closed file: File->Recently used file. 5) Custom fonts and colors: Format -> Fonts.
