relpipe-data/examples-rename-groups-backreferences.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 01:21:22 +0100
branchv_0
changeset 330 70e7eb578cfa
parent 329 5bc2bb8b7946
permissions -rw-r--r--
Added tag relpipe-v0.18 for changeset 5bc2bb8b7946
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     1
<stránka
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     2
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     3
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     4
	
244
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     5
	<nadpis>Using relpipe-tr-sed with groups and backreferences</nadpis>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     6
	<perex>sed-like substitution with regex groups and backreferences</perex>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     7
	<m:pořadí-příkladu>00800</m:pořadí-příkladu>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     8
2
ab9099ff88fa vkládání zápatí, jmenné prostory, saxon
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     9
	<text xmlns="http://www.w3.org/1999/xhtml">
185
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    10
	
6cd2e54d90ea examples: relpipe-in-cli
František Kučera <franta-hg@frantovo.cz>
parents: 184
diff changeset
    11
		<p>
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    12
			This tool also support regex groups and backreferences. Thus we can use parts of the matched string in our replacement string:
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    13
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    14
		
329
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    15
		<m:pre jazyk="bash"><![CDATA[relpipe-in-cli \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    16
	--relation 'r' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    17
		--attribute 'a' string \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    18
		--record 'some string xxx_123 some zzz_456 other' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    19
	| relpipe-tr-sed \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    20
		--relation 'r' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    21
			--attribute 'a' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    22
			--value '([a-z]{3})_([0-9]+)' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    23
			--replacement '$2:$1' \
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    24
	| relpipe-out-tabular]]></m:pre>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    25
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    26
		<p>Which would convert this:</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    27
		<pre><![CDATA[r:
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    28
 ╭────────────────────────────────────────╮
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    29
 │ a                             (string) │
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    30
 ├────────────────────────────────────────┤
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    31
 │ some string xxx_123 some zzz_456 other │
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    32
 ╰────────────────────────────────────────╯
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    33
Record count: 1]]></pre>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    34
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    35
		<p>into this:</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    36
		<pre><![CDATA[r:
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    37
 ╭────────────────────────────────────────╮
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    38
 │ a                             (string) │
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    39
 ├────────────────────────────────────────┤
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    40
 │ some string 123:xxx some 456:zzz other │
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    41
 ╰────────────────────────────────────────╯
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    42
Record count: 1]]></pre>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    43
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    44
		<p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    45
			If there were any other relations or attributes in the stream, they would be unaffected by this transformation,
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    46
			becase we specified <code>'r' 'a'</code> instead of some wider regular expression that would match more relations or attributes.
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    47
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    48
		
87
25dec6931f18 Lepší odsazení, tabulátory.
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    49
	</text>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    50
1
a05c6f3cbc3e základ, první verze
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
</stránka>