From 089a27ab9df5e7a21707f4293888e986b9d8c3d7 Mon Sep 17 00:00:00 2001 From: Bauke Date: Wed, 2 Nov 2022 11:30:02 +0100 Subject: [PATCH] Add regex redirect usage information and an example. --- source/options/components/usage.ts | 18 +++++++++++++++++- source/options/examples.ts | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/source/options/components/usage.ts b/source/options/components/usage.ts index 49c11a6..3ddc37b 100644 --- a/source/options/components/usage.ts +++ b/source/options/components/usage.ts @@ -95,7 +95,7 @@ export default class Usage extends Component { https://tildes.net/~creative.timasomo - Regex + Regex HOL{3}O https://git.bauke.xyz/holllo2 @@ -103,6 +103,12 @@ export default class Usage extends Component { ^https?://www\\.holllo\\.org/?$ https://www.holllo.org/ + + + ${'^(?https://holllo\\.org)/(?1)-(?2)$'} + + https://holllo.org/1-2 + @@ -149,11 +155,21 @@ export default class Usage extends Component { https://holllo.org/home https://holllo.org + + Regex2 + ${'$/$-$'} + https://holllo.org/1-2 + https://holllo.org/2-1 +
  1. The bold highlighted text shows what will be changed.
  2. +
  3. + The regex redirect only works in combination with the regex matcher, + as the regex matcher will be used for the capturing groups. +
`; diff --git a/source/options/examples.ts b/source/options/examples.ts index dbce4b9..bd8ff13 100644 --- a/source/options/examples.ts +++ b/source/options/examples.ts @@ -28,6 +28,14 @@ const examples: RedirectParameters[] = [ redirectType: 'simple', redirectValue: 'https://holllo.org/re-nav', }, + { + enabled: true, + id: -1, + matcherType: 'regex', + matcherValue: '^(?https://holllo\\.org)/(?1)-(?2)$', + redirectType: 'regex', + redirectValue: '$/$-$', + }, ]; export async function generateExamples(): Promise<