topic "Advanced Find and Replace";
[l288;i1120;a17;O9;~~~.1408;2 $$1,0#10431211400427159095818037425705:param]
[a83;*R6 $$2,5#31310162474203024125188417583966:caption]
[H4;b83;*4 $$3,5#07864147445237544204411237157677:title]
[i288;O9;C2 $$4,6#40027414424643823182269349404212:item]
[b42;a42;ph2 $$5,5#45413000475342174754091244180557:text]
[l288;b17;a17;2 $$6,6#27521748481378242620020725143825:desc]
[l321;C@5;1 $$7,7#20902679421464641399138805415013:code]
[b2503;2 $$8,0#65142375456100023862071332075487:separator]
[*@(0.0.255)2 $$9,0#83433469410354161042741608181528:base]
[C2 $$10,0#37138531426314131251341829483380:class]
[l288;a17;*1 $$11,11#70004532496200323422659154056402:requirement]
[i417;b42;a42;O9;~~~.416;2 $$12,12#10566046415157235020018451313112:tparam]
[b167;C2 $$13,13#92430459443460461911108080531343:item1]
[i288;a42;O9;C2 $$14,14#77422149456609303542238260500223:item2]
[*@2$(0.128.128)2 $$15,15#34511555403152284025741354420178:NewsDate]
[l321;*C$7;2 $$16,16#03451589433145915344929335295360:result]
[l321;b83;a83;*C$7;2 $$17,17#07531550463529505371228428965313:result`-line]
[l160;*C+117 $$18,5#88603949442205825958800053222425:package`-title]
[2 $$19,0#53580023442335529039900623488521:gap]
[C2 $$20,20#70211524482531209251820423858195:class`-nested]
[b50;2 $$21,21#03324558446220344731010354752573:Par]
[2 $$0,0#00000000000000000000000000000000:Default]
[{_}%EN-US 
[s2; Advanced Find and Replace&]
[s3; Table of contents&]
[s0; &]
[s0; [^topic`:`/`/ide`/app`/AdvancedReplace`_en`-us`#1^ 1. Introduction]&]
[s0; &]
[s3;:1: 1. Introduction&]
[s5; TheIDE find and replace in the block, using wildcards, has some 
specific features available that make it suitable for some lightweight 
text transformations.&]
[s5; ([/ Note: TheIDE also supports normal regular expressions in addition 
to wildcards.)]&]
[s5; Now first thing to mention is that you can search and replace 
for line ending character using [* `\n] and for tabulator using 
[* `\t] (use `\`\n and `\`\t for escaping). So to put several lines 
into single line, use&]
[s0;l128; search:-|[* `\n]&]
[s0;l128; replace:-|[@(128) (nothing)]&]
[s5; Or to replace `',`' with tabulator, use&]
[s0;l128; search:-|,&]
[s0;l128; replace:-|[* `\t]&]
[s5; When search`&replace is case`-insensitive, it is often useful 
when replace follows the case of source. This option is activated 
by `"Mimic case`" switch. Consider&]
[s0; &]
[s7; Foo&]
[s7; FOO&]
[s7; foo&]
[s7; FoO&]
[s0; &]
[s0;= 
@@image:1977&848
([encoded data, 6248 characters])
&]
[s0; &]
[s7; Bar&]
[s7; BAR&]
[s7; bar&]
[s7; Bar&]
[s0; &]
[s5; Note that in the last line, the last letter is not uppercased 
`- replaced text can have different length, so the result of 
operation is determined by checking the first two characters 
only, resulting in lower`-case, upper`-case or init`-caps scenarios.&]
[s5; For more interesting things to happen, you can activate wildcards:&]
[s0; &]
[s0;= 
@@image:1977&848
([encoded data, 7088 characters])
&]
[s0; &]
[s5; Wildcards allow matching numbers, identifiers, spaces or any 
text. You can get help about wildcards and insert wildcards by 
clicking small arrow in the right part of Find field:&]
[s0; &]
[s0;= 
@@image:2922&1023
([encoded data, 12568 characters])
&]
[s0;= &]
[s5; Note that pattern matching is done on per`-line basis (`'One 
or more any characters`' do not include line`-ending). When pattern 
is matched, it is possible to use matched wildcards in replace 
text. Again, you can get the list of replacement placeholders 
by clicking small arrow in the right part of Find field:&]
[s0; &]
[s0;= 
@@image:2625&2160
([encoded data, 33900 characters])
&]
[s0; &]
[s5; Now for some practical examples. Suppose you want to `'extract`' 
only identifiers inside THISBACK(). You can do that using&]
[s0; &]
[s7;~~~32; out.Escape(`"EditFile(...)`", THISBACK(MacroEditFile));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(MacroSaveCurrentFile));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(MacroCloseFile));&]
[s0; &]
[s0;l128;~~~32; search:-|[* `*THISBACK(`$)`*`\n]&]
[s0;l128;~~~32; replace:-|[* `$`\n]&]
[s0; &]
[s7; MacroEditFile&]
[s7; MacroSaveCurrentFile&]
[s7; MacroCloseFile&]
[s7; &]
[s5; You can use positional replace wildcards to change the order 
of identifiers, e.g.&]
[s0; &]
[s7;~~~32; out.Escape(`"EditFile(...)`", THISBACK(MacroEditFile));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(MacroSaveCurrentFile));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(MacroCloseFile));&]
[s7; &]
[s0;l128;~~~384; [/ search:-|][* `*`"`$`*THISBACK(`$)`*`\n]&]
[s0;l128;~~~384; [/ replace:-|][* `*`"`@4`*THISBACK(`@2)`*`\n]&]
[s0; &]
[s7; out.Escape(`"MacroEditFile(...)`", THISBACK(EditFile));&]
[s7; out.Escape(`"MacroSaveCurrentFile()`", THISBACK(SaveCurrentFile));&]
[s7; out.Escape(`"MacroCloseFile()`",THISBACK(CloseFile));&]
[s7; &]
[s5; In replace wildcard, it is also possible to specify that the 
text is converted to upper`-case, lower`-case or init`-caps (first 
letter upper`-case, rest lowercase):&]
[s0; &]
[s7;~~~32; out.Escape(`"EditFile(...)`", THISBACK(MacroEditFile));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(MacroSaveCurrentFile));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(MacroCloseFile));&]
[s7; &]
[s0;l128; search:-|[* THISBACK(`$)]&]
[s0;l128; replace:-|[* THISBACK(`$`+)]&]
[s0; &]
[s7; out.Escape(`"EditFile(...)`", THISBACK(MACROEDITFILE));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(MACROSAVECURRENTFILE));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(MACROCLOSEFILE));&]
[s7; &]
[s5; Finally, it it also possible to insert the replace index (either 
0 or 1 based) into replace text (here combined with init`-caps):&]
[s0; &]
[s7;~~~32; out.Escape(`"EditFile(...)`", THISBACK(MacroEditFile));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(MacroSaveCurrentFile));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(MacroCloseFile));&]
[s7; &]
[s0;l128;~~~384; [/ search:-|][* THISBACK(`$)]&]
[s0;l128;~~~384; [/ replace:-|][* THISBACK(`$!`@#)]&]
[s0; &]
[s7; out.Escape(`"EditFile(...)`", THISBACK(Macroeditfile1));&]
[s7; out.Escape(`"SaveCurrentFile()`", THISBACK(Macrosavecurrentfile2));&]
[s7; out.Escape(`"CloseFile()`",THISBACK(Macroclosefile3));&]
[s7; &]
[s0; ]]