> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.adnabu.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 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/.

2. 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.

3. 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).

4. Groups and Alternation

 ( ) → Defines a capture group.
 | → Works like OR between patterns.

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

5. 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.