Articles on: Nabu Redirect Manager

What are the supported RegEx syntax for redirects in Nabu Redirect Manager?

Nabu Redirect Manager supports JavaScript-style Regular Expressions (RegEx) for setting up advanced redirects in your Shopify store.


Supported RegEx Syntax


Here are the main RegEx features supported in the app:


  1. Anchors


^ → Matches the start of a URL path.

$ → Matches the end of a URL path.


Example: ^/products/.*$Matches any URL that starts with /products/.


  1. Character Classes


. → Matches any single character.

[abc] → Matches any one character inside the brackets.

[0-9] → Matches any digit between 0–9.

[^abc] → Matches any character except a, b, or c.


Example**: ^/products/[0-9]+$Matches /products/123, /products/456, etc.


  1. Quantifiers


(*) → Matches 0 or more repetitions.

(*) → Matches 1 or more repetitions.

? → Matches 0 or 1 repetition.

{n} → Matches exactly n times.

{n,} → Matches n or more times.

{n,m} → Matches between n and m times.


Example: ^/products/[a-z]{3,5}$Matches product handles with 3 to 5 letters (e.g., /products/bag, /products/shoes).


  1. Groups and Alternation


( ) → Defines a capture group.

| → Works like OR between patterns.


Example: ^/(products|collections)/(.*)$Matches both /products/... and /collections/....


  1. Capture Groups


(pattern) → Captures part of the match.

$1, $2, … $5 → Reuse captured values in the target link.

Nabu supports up to 5 capture groups.


Source Path: ^/products/(.)/(.)$Target Link: /new-products/$1/$2/products/men/shoes → /new-products/men/shoes.


Shopify Examples


  • Redirect all products to a single collection :


Source Path: ^/products/.*$Target Link: /collections/all-products


  • Redirect product IDs (numbers only) to a new collection


Source Path: ^/products/[0-9]+$Target Link: /collections/special-deals


  • Redirect with capture groups


Source Path: ^/products/(.*)$Target Link: /collections/$1/products/shirt → /collections/shirt.


  • Redirect both products and collections


Source Path: ^/(products|collections)/(.*)$Target Link: /archived/$1/$2/products/hat → /archived/products/hat.

Updated on: 30/09/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!