Remove the source code line number using a regular expression,
Abstract: remove the source code line number with a regular expression, and then learn some common Regular Expression operators. Remove the row number step: first use search-replace, then use regular expression to match the row number, and then replace it with null.
The regular expression is:
^\d+\.
Note:
^ Indicates the starting position of the row.
\ D + match Digit
\. Match separator "."
\<\d+\>
It is used to match the line number with spaces and no delimiters in the future.
Table 1 Regular Expression Operators
| Operator |
Effect |
| . |
Match any single character. |
| ? |
The previous items are optional and can be matched at most once. |
| * |
Matches the previous project that appears zero or multiple times. |
| + |
Match the previous project once or multiple times. |
| {N} |
Precisely match N previous projects. |
| {N ,} |
The previous project matches N or more times. |
| {N, M} |
The previous project matches at least N times, but not more than M times. |
| - |
Indicates that the range is not the first or last in the list or the end point of a range. |
| ^ |
Matches an empty string at the beginning of a row, or a character that is not in the list range. |
| $ |
Matches the null string at the end of the row. |
| \ B |
Matches empty strings on both sides of a word. |
| \ B |
Match the provided Null string Matches the empty string provided it's not at the edge of a word. |
| \ < |
Matches an empty string starting with any word. |
| \> |
Matches an empty string at the end of any word. |