Siga as instruções abaixo ao pressionar Ctrl
+ H
de Notepad ++ para combinar um grupo de números de 4 dígitos por cada linha e imprimir apenas os caracteres, dando-lhe os resultados esperados.
-
Encontre o que:
^.*?(\d{4}+).*$
-
Substitua por:
$1
-
Modo de pesquisa:
Regular expression
- Pressione Substituir tudo
Resultados
2005
2007
2002
1986
1997
1979
Maisrecursos
How to use regular expressions in Notepad++
Anchors
Anchors match a position in the line, rather than a particular character.
^
This matches the start of a line (except when used inside a set, see above).
$
This matches the end of a line.
Ranges or kinds of characters
[^...]
The complement of the characters in the set.
Single-character matches
., \c
Matches any character. If you check the box which says ". matches newline", the dot will indeed do that, enabling the "any" character to run over multiple lines. With the option unchecked, then . will only match characters within a line, and not the line ending characters (\r and \n)
Multiplying operators
*
This matches 0 or more instances of the previous character, as many as it can. For example, Sa*m matches Sm, Sam, Saam, and so on.
*?
Zero or more of the previous group, but minimally: the shortest matching string, rather than the longest string as with the "greedy" * operator. Thus, m.*?o applied to the text margin-bottom: 0; will match margin-bo, whereas m.*o will match margin-botto.
{n}
Matches n copies of the element it applies to.
+
This matches 1 or more instances of the previous character, as many as it can.
Groups
(...)
Parentheses mark a subset of the regular expression. The string matched by the contents of the parentheses
( )
can be re-used as a backreference or as part of a replace operation; see Substitutions, below.Groups may be nested.
(?<some name>...), (?'some name'...),(?(some name)...)
Ranges or kinds of characters
\d
A digit in the 0-9 range, same as [[:digit:]].
Substitutions
$n, ${n}, \n
Returns what matched the subexpression numbered n. Negative indices are not alowed.