
Tengo una lista de palabras y caracteres no deseados.
hag-lawig
ha
waray
katapusan
/
¤
8¨2Þ‹%·/ój
An
ngatanan
nga
makakita
ha
akon
Quiero eliminar todas las líneas que contengan caracteres distintos de una determinada cadena de caracteres; en mi caso "az" y "-". Es decir, en este caso, se deben eliminar las líneas que contienen "ó" "A" "%", etc.:
hag-lawig
ha
waray
katapusan
ngatanan
nga
makakita
ha
akon
¡Gracias por su ayuda!
Respuesta1
- Ctrl+H
- Encontrar que:
^.*[^a-z-].*$\R?
- Reemplazar con:
LEAVE EMPTY
- comprobar Envolver alrededor
- comprobar expresión regular
- DESMARCAR
. matches newline
- Replace all
Explicación:
^ # beginning of line
.* # 0 or more any character but newline
[^a-z-] # any character that is not lowercase or dash
.*
$ # end of line
\R? # any kind of linebreak, optional
Resultado para el ejemplo dado:
hag-lawig
ha
waray
katapusan
ngatanan
nga
makakita
ha
akon