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> <td>https://<b>tildes.net</b>/~creative.timasomo</td>
</tr> </tr>
<tr class="alt"> <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 class="center-text">HOL{3}O</td>
<td>https://git.bauke.xyz/<b>holllo</b><sup>2</sup></td> <td>https://git.bauke.xyz/<b>holllo</b><sup>2</sup></td>
</tr> </tr>
@ -103,6 +103,12 @@ export default class Usage extends Component {
<td class="center-text">^https?://www\\.holllo\\.org/?$</td> <td class="center-text">^https?://www\\.holllo\\.org/?$</td>
<td><b>https://www.holllo.org/</b></td> <td><b>https://www.holllo.org/</b></td>
</tr> </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> </tbody>
</table> </table>
@ -149,11 +155,21 @@ export default class Usage extends Component {
<td>https://holllo.org/home</td> <td>https://holllo.org/home</td>
<td><b>https://holllo.org</b></td> <td><b>https://holllo.org</b></td>
</tr> </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> </tbody>
</table> </table>
<ol class="footnotes"> <ol class="footnotes">
<li>The bold highlighted text shows what will be changed.</li> <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> </ol>
</details> </details>
`; `;

View File

@ -28,6 +28,14 @@ const examples: RedirectParameters[] = [
redirectType: 'simple', redirectType: 'simple',
redirectValue: 'https://holllo.org/re-nav', 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< export async function generateExamples(): Promise<