Ambos lados, revisión anteriorRevisión previa | Próxima revisiónAmbos lados, revisión siguiente |
es:howtos:general_admin:cli_constructs_and_useful_info [2019/02/07 19:41 (UTC)] – [Construye] slackwarespanol | es:howtos:general_admin:cli_constructs_and_useful_info [2019/02/07 19:53 (UTC)] – [Regular expressions] slackwarespanol |
---|
=== Enlaces externos === | === Enlaces externos === |
* http://www.grymoire.com/Unix/Quote.html | * http://www.grymoire.com/Unix/Quote.html |
==== Regular expressions ==== | ==== Expresiones regulares ==== |
=== Basic === | === Básico === |
* ''.'' matches any single character. | * ''. '' coincide con cualquier carácter individual. |
* ''\'' escapes the next character. | * '' \ '' evita del siguiente carácter. |
<note>Remember to escape the ''.'' using ''\.'' if you want an actual ''.'' | <note>Recuerde que debe evitar ''. '' usando '' \. '' Si quieres un verdadero ''. '' |
<code> | <code> |
bash-4.2$ cat test.txt | bash-4.2$ cat test.txt |
test | test |
</code></note> | </code></note> |
* ''[]'' is a class and matches anything inside the brakets for a single character. Examples: | |
* ''[Yy]'' matches Y or y. | * '' [ ] '' es una clase y combina cualquier cosa dentro de los corchetes para un solo personaje. Ejemplos: |
* ''[a-z0-9]'' includes a range, and in this case matches a through z and 0 through 9. | * '' [Yy] '' coincide con Y o y. |
* ''[^a-z]'' negates the range, so in this case it matches anything but a through z. | * '' [a-z0-9] '' incluye un rango, y en este caso coincide con a a través de z y de 0 a 9. |
* ''^'' matches the beginning of a line. Example: ''^a'' matches an a at the beginning of a line. | * '' [^ a-z] '' niega el rango, por lo que, en este caso, se ajusta a cualquier cosa excepto a a z. |
* ''$'' matches the end of a line. Example: ''a$'' matches an a at the end of a line. | * '' ^ '' coincide con el principio de una línea. Ejemplo: '' ^ a '' coincide con una a al principio de una línea. |
* ''\<'' matches the beginning of a word. Example: ''\<a'' matches an a at the beginning of a word. | * '' $ '' coincide con el final de una línea. Ejemplo: '' a $ '' coincide con una a al final de una línea. |
* ''\>'' matches the end of a word. Example: ''a\>'' matches an a at the end of a word. | * '' \ <'' coincide con el principio de una palabra. Ejemplo: '' \ <a '' coincide con una a al principio de una palabra. |
* Example: ''\<[tT]he\>'' matches the word ''the'' or ''The''. | * '' \> '' coincide con el final de una palabra. Ejemplo: '' a \> '' coincide con una a al final de una palabra. |
* ''*'' matches any number of the previous character or nothing = no character. Example: ''[0-9]*'' which will match any number of numbers. ''.*'' matches any number of anything. | * Ejemplo: '' \ <[tT] he \> '' coincide con la palabra '' el '' o '' El ''. |
| * '' * '' coincide con cualquier número del carácter anterior o nada = ningún carácter. Ejemplo: '' [0-9] * '' que coincidirá con cualquier número de números. ''. * '' coincide con cualquier número de cualquier cosa. |
=== Extended regular expressions === | === Extended regular expressions === |
The following must be supported by the program for them to work. For example for grep you must run ''egrep'' or ''grep -E''. | The following must be supported by the program for them to work. For example for grep you must run ''egrep'' or ''grep -E''. |