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