Liste over regulære uttrykk

Term

Representation/Use

Vilkårleg teikn

The given character unless it is a regular expression meta character, which follow in this table.

.

Kva bokstav som helst unntatt linjeskift og ny linje. For eksempel vil «k.rt» passa både «kart» og «kort».

^

Byrjinga av eit avsnitt eller ei celle. Spesielle objekt som tomme felt eller rammer kopla til ein bokstav i byrjinga av eit avsnitt vert ignorerte. Såleis vil «^Peter» passa med ordet «Peter» berre når det er det første ordet i eit avsnitt.

$

Slutten av eit avsnitt eller ei celle. Spesielle objekt som tomme felt eller rammer kopla til ein bokstav i byrjinga av eit avsnitt vert ignorerte. Såleis vil «Peter$» passa med ordet «Peter» berre når det er det siste ordet i eit avsnitt.

$ åleine svarar til slutten av eit avsnitt. På denne måten er det råd å søka og byta ut avsnittskiljeteikn.

*

Ingen eller fleire regulære uttrykk som følgjer like etter. For eksempel vil «Ab*c» passa «Ac»,«Abc»,«Abbc»,«Abbbc» og så vidare.

+

Eitt eller fleire regulære uttrykk som er like før. For eksempel vil «AX.+4» finna «AXx4» men ikkje «AX4c».

Den lengste moglege strengen i eit avsnitt som passar dette regulære uttrykket i eit avsnitt. Viss avsnittet inneheld strengen «AX 4 AX4», vert heile avsnittet markert.

?

Ingen eller eitt regulært uttrykk som er like før. For eksempel vil «Teksta?» finna «Tekst» og «Teksta». «x(ab|c)?y» finds «xy», «xaby» og «xcy».

\

Søket tolkar spesialteiknet etter «\» som eit normalt teikn, ikkje som eit regulært uttrykk (med unntak for «\n», «\t», «\>» og «\<»). For eksempel vil «tre\.» gje treff på «tre.» men ikkje på «treg» eller «trea».

\n

Eit linjeskift som vart sett inn med tastekombinasjonen Shift + Enter i tekstruta Finn.

Du kan skriva inn eit linjeskift med Enter eller Return i tekstruta Byt ut.

For å endra ªny linje» til linjeskift, skriv inn «\n» i både Finn og Byt ut og utfør søk og byt ut.

\t

Eit tabulatorteikn. Kan også brukast iByt ut.

\b

Ei ordgrense. For eksempel vil «\bbok» finna «bokmerke» og "bok", men ikkje «lommebok», medan «bok\b" vil finna «lommebok» men ikkje «bokmerke».

Denne forma erstattar den forelda, men framleis gyldige, forma «\>» (finn slutten av ordet) og «\<» (finn starten av ordet).

^$

Finn eit tomt avsnitt.

^.

Finn det første teiknet i eit avsnitt.

& eller $0

Legg tekststrengen, som vart funnen med søkjekriteriet i feltet Søk etter, til uttrykket i feltet Byt ut med når du byter ut.

Dersom du for eksempel skriv inn «vindauge» i Finn og «&ramme» i «Byt ut», vert ordet «vindauge» byt ut med «vindaugeramme».

You can also enter an "&" in the Replace box to modify the Attributes or the Format of the string found by the search criteria.

[...]

Éin enkelt førekomst av eitt av teikna mellom klammeparentesane. For eksempel: «[abc123]» samsvarar med teikna «a», «b», «c», «1», «2» og «3». «[a-e]» samsvarer med enkeltførekomstar av teikna frå og med a til og med e. (området må gjevast med teiknet som har det minste Unicode-nummeret først). «[a-eh-x]» samsvarar alle enkeltførekomstar av teikna som er i området «en» gjennom «e» og «h» gjennom «x».

[^...]

Kva enkeltførekomst som helst av teikn, inkludert teikna for tabulator, mellomrom og linjeskift, som ikkje er i lista over teikn som er oppgjeve i inkluderande område er tillatne. For eksempel vil «[^ a-SYZ]"» samsvara med alle teikn som ikkje er i det inkluderande området «a» til « » eller teikna «y» og «z».

\uXXXX

\UXXXXXXXX

Teiknet som er representert av den firesifra heksadesimale koden (XXXX).

Teiknet som er representert av den åtteifra heksadesimale Unicode-koden (XXXXXXXX).

For visse symbolskrifter kan verdien av spesialteikn vera avhengig av skrifttypen som vert brukt. Du kan sjå verdiane ved å velja Set inn → Spesialteikn.

|

The infix operator delimiting alternatives. Matches the term preceding the "|" or the term following the "|". For example, "this|that" matches occurrences of both "this" and "that".

{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}" marches "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.

  1. To enclose a set of ‘|’ alternatives. For example, the regular expression "b(oo|ac)k" matches both "book" and "back".

  2. 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".

  3. 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, where the reference to the first matched sub string in the current expression in the Find box 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.

For example, the regular expression "(890)7\1\1" matches "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:]

Representerer ein bokstav. Bruk [:alpha:]+ for å finne éin av dei.

[:digit:]

Representerer eit desimaltal. Bruk [:digit:]+ for å finne eitt av dei.

[:alnum:]

Står for eit alfanumerisk teikn ([:alpha:] og [:digit:]).

[:space:]

Representerer eit mellomromsteikn (men ingen andre blankteikn).

[:print:]

Står for eit teikn som kan skrivast ut.

[:cntrl:]

Står for eit kontrollteikn, eit teikn som ikkje vert skrive ut.

[:lower:]

Står for ein liten bokstav viss Skil store og små bokstavar er valt under Innstillingar.

[:upper:]

Står for ein liten bokstav viss Skil store og små bokstavar er valt under Innstillingar.


Du kan finna ei fullstendig liste over støtta metateikn og syntaks i ICU Regular Expressions documentation

Note that currently all named character class terms, [:alpha:] through [:upper:], must be enclosed in parentheses when used in a regular expression, see the examples that follow.

Regular expression terms can be combined to form complex and sophisticated regular expressions for searches as show in the following examples.

Eksempel

Expression

Meaning

^$

An empty paragraph.

^ specifies that the match must be at the start of a paragraph,

$ specifies that a paragraph mark or the end of a cell must follow the matched string.

^.

The first character of a paragraph.

^ specifies that the match must be at the start of a paragraph,

. specifies any single character.

e([:digit:])?

Matches "e" by itself or an "e" followed by one digit.

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.

^ specifies that the match must be at the start of a paragraph,

[: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

^ specifies that the match must be at the start of a paragraph,

[: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.