Add regex redirect usage information and an example.

This commit is contained in:
Bauke 2022-11-02 11:30:02 +01:00
parent 2665ee3298
commit 089a27ab9d
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 25 additions and 1 deletions

View File

@ -95,7 +95,7 @@ export default class Usage extends Component {
<td>https://<b>tildes.net</b>/~creative.timasomo</td>
</tr>
<tr class="alt">
<td class="bold center-text" rowspan="2">Regex</td>
<td class="bold center-text" rowspan="3">Regex</td>
<td class="center-text">HOL{3}O</td>
<td>https://git.bauke.xyz/<b>holllo</b><sup>2</sup></td>
</tr>
@ -103,6 +103,12 @@ export default class Usage extends Component {
<td class="center-text">^https?://www\\.holllo\\.org/?$</td>
<td><b>https://www.holllo.org/</b></td>
</tr>
<tr>
<td class="center-text">
${'^(?<base>https://holllo\\.org)/(?<one>1)-(?<two>2)$'}
</td>
<td><b>https://holllo.org/1-2</b></td>
</tr>
</tbody>
</table>
@ -149,11 +155,21 @@ export default class Usage extends Component {
<td>https://holllo.org/home</td>
<td><b>https://holllo.org</b></td>
</tr>
<tr>
<td class="bold center-text">Regex<sup>2</sup></td>
<td>${'$<base>/$<two>-$<one>'}</td>
<td>https://holllo.org/1-2</td>
<td><b>https://holllo.org/2-1</b></td>
</tr>
</tbody>
</table>
<ol class="footnotes">
<li>The bold highlighted text shows what will be changed.</li>
<li>
The regex redirect only works in combination with the regex matcher,
as the regex matcher will be used for the capturing groups.
</li>
</ol>
</details>
`;

View File

@ -28,6 +28,14 @@ const examples: RedirectParameters[] = [
redirectType: 'simple',
redirectValue: 'https://holllo.org/re-nav',
},
{
enabled: true,
id: -1,
matcherType: 'regex',
matcherValue: '^(?<base>https://holllo\\.org)/(?<one>1)-(?<two>2)$',
redirectType: 'regex',
redirectValue: '$<base>/$<two>-$<one>',
},
];
export async function generateExamples(): Promise<