Sign in Join
Wiki copytemporary

IDE regular expressions/fi: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Säännöllinen lauseke
22
33## Normaali säännöllinen lauseke
44
55Erikoismerkit:
66
7-`   \   Pitää seuraavaa erikoismerkkiä normaalina merkkinä. Tai jos on jokin merkki a-z:n tai A-Z:n `\
8-`       väliltä niin sillä saattaa olla erikoismerkitys (katso takakenoviivan erikoismerkitykset kohtaa)`\
9-`   ^   Match the beginning of the line`\
10-`   .   Sopii mikä tahansa merkki (paitsi uusi rivi). Esimerkiksi: 'a.c':n soveltuvat 'abc', 'aBC', `\
11-`       'axc', 'a3c', 'a$c', jne.`\
12-`   $   Match the end of the line (or before newline at the end)`\
13-`   |   Tai`\
14-`   ()  Grouping. For example: (abc)+ matches 'abc' or 'abcabc' or 'abcabcabc' etc.`\
15-`   []  Vaihtoehtoisten merkkien joukko. Esimerkiksi [abc], [a-z], [a-zA-Z0-9_]`\
16-`   [^]   Ei hyväksyttävien merkkien joukko. Esimerkiksi [^a-z]`
7+``` pascal
8+ \ Pitää seuraavaa erikoismerkkiä normaalina merkkinä. Tai jos on jokin merkki a-z:n tai A-Z:n
9+ väliltä niin sillä saattaa olla erikoismerkitys (katso takakenoviivan erikoismerkitykset kohtaa)
10+ ^ Match the beginning of the line
11+ . Sopii mikä tahansa merkki (paitsi uusi rivi). Esimerkiksi: 'a.c':n soveltuvat 'abc', 'aBC',
12+ 'axc', 'a3c', 'a$c', jne.
13+ $ Match the end of the line (or before newline at the end)
14+ | Tai
15+ () Grouping. For example: (abc)+ matches 'abc' or 'abcabc' or 'abcabcabc' etc.
16+ [] Vaihtoehtoisten merkkien joukko. Esimerkiksi [abc], [a-z], [a-zA-Z0-9_]
17+ [^] Ei hyväksyttävien merkkien joukko. Esimerkiksi [^a-z]
18+```
1719
1820Quantifiers:
1921
20-`   *      Match 0 or more times`\
21-`   +      Match 1 or more times`\
22-`   ?      Match 1 or 0 times`\
23-`   {n}    Match exactly n times`\
24-`   {n,}   Match at least n times`\
25-`   {n,m}  Match at least n but not more than m times`
22+```text
23+ * Match 0 or more times
24+ + Match 1 or more times
25+ ? Match 1 or 0 times
26+ {n} Match exactly n times
27+ {n,} Match at least n times
28+ {n,m} Match at least n but not more than m times
29+```
2630
2731Curly brackets in any other context is treated as a regular character. The \`\`**is equivalent to {0,}, the \`\`+* to {1,} and the \`\`?'' to {0,1}.
2832
2933By default, a quantifier is *greedy*, that means, it will match as many times as possible. To match the minimum number of times possible, append a \`\`?''.
3034
31-`   *?     Match 0 or more times`\
32-`   +?     Match 1 or more times`\
33-`   ??     Match 0 or 1 time`\
34-`   {n}?   Match exactly n times`\
35-`   {n,}?  Match at least n times`\
36-`   {n,m}? Match at least n but not more than m times`
35+```text
36+ *? Match 0 or more times
37+ +? Match 1 or more times
38+ ?? Match 0 or 1 time
39+ {n}? Match exactly n times
40+ {n,}? Match at least n times
41+ {n,m}? Match at least n but not more than m times
42+```
3743
3844## Simple Syntax
3945
4046Some IDE dialogs provide a checkbox to enable 'simple syntax'. These regular expressions are shorter for common file name filters.
4147
4248Technically it does this:
4349
4450 The following characters are replaced with
4551 . -> \.
4652 * -> .*
4753 ? -> .
4854 , -> |
4955 ; -> |
5056
5157 Finally enclose by ^( )$
5258
5359## Takakenoviivan erikoismerkitykset
5460
5561Takakenoviivaa ("\\" eli backslash-merkkiä) käytetään poistamaan joiltakin merkeiltä kuten pisteeltä (".") poistamaan sen erikoismerkityksen eli silloin se tarkoittaa normaalia pistettä. Toisena merkityksenä sillä on mahdollistaa muutamia erikoismerkityksiä.
5662
5763 \. matches a point '.'
5864 \d matches a number character '0'..'9'
5965 \D matches a non number character
6066 \s matches a space character ' ',#9,#10,#12,#13
6167 \S matches a non space character
6268 \w matches a word character 'a'..'z','A'..'Z','0'..'9','_'
6369 \W matches a non word character
6470 \b word boundary
6571 \B not word boundary
6672 \A begin of line
6773 \Z end of line
6874
6975## Säännöllinen lauseke etsi ja korvaa toiminnoissa
7076
7177"Etsi" sekä "Etsi ja korvaa" ikkunat tukevat säännöllisiä lausekeita etsinnässä ja korvaamisessa. Each found pattern grouped in round brackets can be used by a \$1, ..., \$9 variable
7278
7379For example:
7480
7581- Find expression: a(.*)c
7682- Replace expression: A\$1C
7783- Text: 'abc aLazc'
7884
7985The \$1 will be replaced with the found text, that matches the first bracket.
8086
8187- Result: 'AbC ALazC'
8288
8389---
8490*From the Free Pascal wiki, page "IDE regular expressions/fi", as it stood on 2006-08-10 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history