Contenido
Índice 🔎︎

# Lista de expresiones regulares

Término | Representación/uso
--- | ---
Cualquier carácter | El carácter indicado, salvo que sea un metacarácter de expresiones regulares. La lista de metacaracteres aparece en esta tabla.
. | Any single character except a line break or a paragraph break. For example, the search term "sh.rt" matches both "shirt" and "short".
^ | The beginning of a paragraph or cell. Special objects such as empty fields or character-anchored frames, at the beginning of a paragraph are ignored. Example: "^Peter" matches the word "Peter" only when it is the first word of a paragraph.
$ | The end of a paragraph or cell. Special objects such as empty fields or character-anchored frames at the end of a paragraph are ignored. Example: "Peter$" matches only when the word "Peter" is the last word of a paragraph, note "Peter" cannot be followed by a period. $ por sí solo coincide con el final de un párrafo. De esta manera, es posible buscar y reemplazar saltos de párrafo.
* | Zero or more of the regular expression term immediately preceding it. For example, "Ab*c" matches "Ac", "Abc", "Abbc", "Abbbc", and so on.
+ | One or more of the regular expression term immediately preceding it. For example, "AX.+4" finds "AXx4", but not "AX4". The longest possible string that matches this regular expression in a paragraph is always matched. If the paragraph contains the string "AX 4 AX4", the entire passage is highlighted.
? | Zero or one of the regular expression term immediately preceding it. For example, "Texts?" matches "Text" and "Texts" and "x(ab|c)?y" finds "xy", "xaby", or "xcy".
\ | The special character that follows it is interpreted as a normal character and not as a regular expression meta character (except for the combinations "\n", "\t", "\b", "\>" and "\<"). For example, "tree\." matches "tree.", not "treed" or "trees".
\n | When entered in the Find text box, finds a line break that was inserted with the Shift+Enter key combination in Writer, or the Ctrl+Enter key combination in a Calc cell. When entered in the Replace text box in Writer, inserts a paragraph break that can be inserted with the Enter or Return key. Has no special meaning in Calc, and is treated literally there. To change line breaks into paragraph breaks in Writer, enter \n in both the Find and Replace boxes, and then perform a search and replace.
\t | Un carácter tabulador. Puede utilizarse también en el cuadro Reemplazar.
\b | A word boundary. For example, "\bbook" matches "bookmark" and "book" but not "checkbook" whereas "book\b" matches "checkbook" and "book" but not "bookmark". Observe que esta forma sustituye a las obsoletas «\>» (encontrar fin de palabra) y «\<» (encontrar comienzo de palabra), aunque estas últimas siguen funcionando por ahora.
^$ | Localiza un párrafo vacío.
^. | Encuentra el primer carácter de un párrafo.
& o $0 | Añade la cadena de caracteres encontrada por los criterios de búsqueda del cuadro Buscar al término del cuadro Reemplazar cuando realice un reemplazo. Por ejemplo, si escribe «cama» en el cuadro Buscar y «&león» en el cuadro Reemplazar, la palabra «cama» se sustituye por «camaleón». También puede introducirse un signo de «&» en el cuadro Reemplazar para modificar los atributos o el formato de la cadena de caracteres que haya encontrado la búsqueda.
[...] | Any single occurrence of any one of the characters that are between the brackets. For example: "[abc123]" matches the characters ‘a’, ‘b’, ’c’, ‘1’, ‘2’ and ‘3’. "[a-e]" matches single occurrences of the characters a through e, inclusive (the range must be specified with the character having the smallest Unicode code number first). "[a-eh-x]" matches any single occurrence of the characters that are in the ranges ‘a’ through ‘e’ and ‘h’ through ‘x’.
[^...] | Any single occurrence of a character, including Tab, Space and Line Break characters, that is not in the list of characters specified inclusive ranges are permitted. For example "[^a-syz]" matches all characters not in the inclusive range ‘a’ through ‘s’ or the characters ‘y’ and ‘z’.
\uXXXX \UXXXXXXXX | El carácter que representa el código hexadecimal Unicode de cuatro dígitos (XXXX). El carácter que representa un código hexadecimal Unicode de ocho dígitos (XXXXXXXX). Para algunos tipos de letra de símbolos, el símbolo (glifo) que se ve en pantalla puede parecer relacionado a un código Unicode diferente del que en realidad se utiliza en el tipo de letra. El código Unicode puede consultarse mediante la opción Insertar ▸ Carácter especial o al emplear el atajo de conversión de Unicode.
| | El operador que delimita alternativas. Encuentra los términos previo y posterior al «|». Por ejemplo, «esto|eso» encuentra ocurrencias tanto de «esto» como de «eso».
{N} | The post-fix repetition operator that specifies an exact number of occurrences ("N") of the regular expression term immediately preceding it must be present for a match to occur. For example, "tre{2}" matches "tree".
{N,M} | The post-fix repetition operator that specifies a range (minimum of "N" to a maximum of "M") of occurrences of the regular expression term immediately preceding it that can be present for a match to occur. For example, "tre{1,2}" matches "tre" and "tree".
{N,} | The post-fix repetition operator that specifies a range (minimum "N" to an unspecified maximum) of occurrences of the regular expression term immediately preceding it that can be present for a match to occur. (The maximum number of occurrences is limited only by the size of the document). For example, "tre{2,}" matches "tree", "treee", and "treeeee".
(...) | The grouping construct that serves three purposes. To enclose a set of ‘|’ alternatives. For example, the regular expression "b(oo|ac)k" matches both "book" and "back". To group terms in a complex expression to be operated on by the post-fix operators: "*", "+" and "?" along with the post-fix repetition operators. For example, the regular expression "a(bc)?d" matches both "ad" and "abcd" in a search.; the regular expression "M(iss){2}ippi" matches "Mississippi". To record the matched sub string inside the parentheses as a reference for later use in the Find box using the "\n" construct or in the Replace box using the "$n" construct. The reference to the first match is represented by "\1" in the Find box and by "$1" in the Replace box. The reference to the second matched sub string by "\2" and "$2" respectively, and so on. Por ejemplo, la expresión regular «(890)7\1\1» casa con «8907890890». With the regular expression "\b(fruit|truth)\b" in the Find box and the regular expression "$1ful" in the Replace box occurrences of the words "fruit" and "truth" can be replaced with the words "fruitful" and "truthful" respectively without affecting the words "fruitfully" and "truthfully"
[:alpha:] | Representa un carácter alfabético. Utilice [:alpha:]+ para encontrar uno.
[:digit:] | Representa un dígito decimal. Utilice [:digit:]+ para encontrar uno.
[:alnum:] | Representa un carácter alfanumérico ([:alpha:] y [:digit]).
[:space:] | Representa un espacio (pero no otros caracteres de espacios en blanco).
[:print:] | Representa un carácter que se puede imprimir.
[:cntrl:] | Representa un carácter que no se puede imprimir.
[:lower:] | Representa un carácter en minúscula si en Opciones se ha seleccionado Distinguir mayúsculas y minúsculas.
[:upper:] | Representa un carácter mayúsculo si se ha activado la opción Distinguir mayúsculas y minúsculas en Opciones.

Para una lista exhaustiva de metacaracteres y sintaxis admitidas, consulte la documentación sobre expresiones regulares de ICU (en inglés).

Estos términos pueden combinarse para formar expresiones regulares complejas y sofisticadas para búsquedas, como se muestra en los ejemplos de más abajo.

## Ejemplos

Expresión | Significado
--- | ---
^$ | Un párrafo vacío. ^ significa que la correspondencia debe ser al inicio de un párrafo; $ specifies that a paragraph mark or the end of a cell must follow the matched string.
^. | El primer carácter de un párrafo. ^ significa que la correspondencia debe ser al inicio de un párrafo; . especifica cualquier carácter individual.
e([:digit:])? | Encuentra «e» en sí misma o «e» seguida por un dígito. e specifies the character "e", [:digit:] specifies any decimal digit, ? specifies zero or one occurrences of [:digit:].
^([:digit:])$ | Matches a paragraph or cells containing exactly one digit. ^ significa que la correspondencia debe ser al inicio de un párrafo; [:digit:] specifies any decimal digit, $ specifies that a paragraph mark or the end of a cell must follow the matched string.
^[:digit:]{3}$ | Matches a paragraph or cell containing only three digit numbers ^ significa que la correspondencia debe ser al inicio de un párrafo; [:digit:] specifies any decimal digit, {3} specifies that [:digit:] must occur three times, $ specifies that a paragraph mark or the end of a cell must follow the matched string.
\bconst(itu|ruc)tion\b | Matches the words "constitution" and "construction" but not the word "constitutional." \b specifies that the match must begin at a word boundary, const specifies the characters "const", ( starts the group, itu specifies the characters "itu", | specifies the alternative, ruc specifies the characters "ruc", ) ends the group, tion specifies the characters "tion", \b specifies that the match must end at a word boundary.

Temas relacionados

Buscar y reemplazar

Utilizar expresiones regulares en búsquedas de texto

Buscar y reemplazar en Writer

Wiki page about regular expressions in Writer

Wiki page about regular expressions in Calc