IDE regular expressions/fi: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | # Säännöllinen lauseke | |
| 2 | 2 | ||
| 3 | 3 | ## Normaali säännöllinen lauseke | |
| 4 | 4 | ||
| 5 | 5 | Erikoismerkit: | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 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 | + | ``` | |
| 17 | 19 | ||
| 18 | 20 | Quantifiers: | |
| 19 | 21 | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 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 | + | ``` | |
| 26 | 30 | ||
| 27 | 31 | Curly brackets in any other context is treated as a regular character. The \`\`**is equivalent to {0,}, the \`\`+* to {1,} and the \`\`?'' to {0,1}. | |
| 28 | 32 | ||
| 29 | 33 | By 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 \`\`?''. | |
| 30 | 34 | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 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 | + | ``` | |
| 37 | 43 | ||
| 38 | 44 | ## Simple Syntax | |
| 39 | 45 | ||
| 40 | 46 | Some IDE dialogs provide a checkbox to enable 'simple syntax'. These regular expressions are shorter for common file name filters. | |
| 41 | 47 | ||
| 42 | 48 | Technically it does this: | |
| 43 | 49 | ||
| 44 | 50 | The following characters are replaced with | |
| 45 | 51 | . -> \. | |
| 46 | 52 | * -> .* | |
| 47 | 53 | ? -> . | |
| 48 | 54 | , -> | | |
| 49 | 55 | ; -> | | |
| 50 | 56 | ||
| 51 | 57 | Finally enclose by ^( )$ | |
| 52 | 58 | ||
| 53 | 59 | ## Takakenoviivan erikoismerkitykset | |
| 54 | 60 | ||
| 55 | 61 | Takakenoviivaa ("\\" 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ä. | |
| 56 | 62 | ||
| 57 | 63 | \. matches a point '.' | |
| 58 | 64 | \d matches a number character '0'..'9' | |
| 59 | 65 | \D matches a non number character | |
| 60 | 66 | \s matches a space character ' ',#9,#10,#12,#13 | |
| 61 | 67 | \S matches a non space character | |
| 62 | 68 | \w matches a word character 'a'..'z','A'..'Z','0'..'9','_' | |
| 63 | 69 | \W matches a non word character | |
| 64 | 70 | \b word boundary | |
| 65 | 71 | \B not word boundary | |
| 66 | 72 | \A begin of line | |
| 67 | 73 | \Z end of line | |
| 68 | 74 | ||
| 69 | 75 | ## Säännöllinen lauseke etsi ja korvaa toiminnoissa | |
| 70 | 76 | ||
| 71 | 77 | "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 | |
| 72 | 78 | ||
| 73 | 79 | For example: | |
| 74 | 80 | ||
| 75 | 81 | - Find expression: a(.*)c | |
| 76 | 82 | - Replace expression: A\$1C | |
| 77 | 83 | - Text: 'abc aLazc' | |
| 78 | 84 | ||
| 79 | 85 | The \$1 will be replaced with the found text, that matches the first bracket. | |
| 80 | 86 | ||
| 81 | 87 | - Result: 'AbC ALazC' | |
| 82 | 88 | ||
| 83 | 89 | --- | |
| 84 | 90 | *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).* |
