Regex when moving from JSON to YAML redirects

I find it much easier to manage redirects and the redirect file when I switched from using JSON to YAML.

All my former ‘straight’ redirects work exactly as expected.

The regex ones do not.

I, possibly naively, assumed both would use the same form of regex.

There are two regex redirects that worked for a JSON redirect file, but don’t work for YAML.

/(\d*)/(\d*)/(\d*)/([A-Za-z0-9-]*): /$4

and

/(.*?)/feed/$: /$1

how do I recast these for YAML redirects?

@BillBennett, instead of flagging your OP, please reply in the thread with your solution. The reply then be marked as a solution, and may help other community members. Thanks.

Fixed this with:

^/[0-9]+/[0-9]+/[0-9]+/(.+): https://billbennett.co.nz/$1

For the first term.

The second term works as it stands:

/(.*?)/feed/$: /$1

1 Like