- Ctrl + H
- Encontre o que:
^.*?(\bhttps://twitter\.com/\w+)?.*$
- Substituir por:
(?1$1:)
- check Embrulhe
- verificar expressão regular
- NÃO VERIFIQUE
. matches newline
- Substituir todos
Explicação:
^ # beginning of line
.*? # 0 or more any character but newline, not greedy
( # start grpup 1
\b # word boundary
https://twitter\.com/ # literally
\w+ # 1 or more word character
)? # end group, optional
.* # 0 or more any character but newline
$ # end of line
Substituição:
(?1$1:) # if group 1 exists, then use it as replacement, else replace with nothing
Resultado para o exemplo dado:
https://twitter.com/thtjournal
https://twitter.com/jcarrollhistory