Skip to main content
Branch patterns map your Git branches to environments (Dev, Staging, Production). Test results automatically route to the correct environment based on the branch that triggered the run.

Quick Reference

SymbolMeaningExample
^Start of name^devdev/test
$End of namemain$main
(?i)Case-insensitive(?i)^main$MAIN
\dAny digitv\dv1
|ORdev|qadev or qa
( )Group^(dev|qa)/dev/ or qa/
See full symbol reference below.

Pattern Types

Exact Match

Match the branch name exactly as written.
PatternMatchesDoes not match
mainmainmain-backup, feature/main
Use exact match for specific branch names like main, master, production.

Regex Patterns

Use regular expressions for flexible matching.
PatternDescriptionMatches
^dev/Starts with dev/dev/feature-123, dev/bug-fix
^main$Exactly mainmain
^(main|master)$Either main or mastermain, master
^release/v\d+Release with versionrelease/v1, release/v2.0

Common Patterns

Branch Prefixes

PatternDescriptionMatches
^feature/Feature branchesfeature/login, feature/payment
^hotfix/Hotfix brancheshotfix/critical-bug
^release/Release branchesrelease/v1.0, release/2024-01
^pull/\d+GitHub PR branchespull/123/merge, pull/456/head

Version Numbers

PatternDescriptionMatches
^release/v\d+Version with v prefixrelease/v1, release/v2.0
^release/\d+\.\d+Semantic versionrelease/1.0, release/2.5
^release/v\d+\.\d+\.\d+$Exact semverrelease/v1.0.0

Case-Insensitive

Use (?i) when your team uses inconsistent casing:
PatternMatches
(?i)^main$main, MAIN, Main
(?i)^release/release/, RELEASE/, Release/

Common Use Cases

Git Flow

EnvironmentPattern
Production^(main|master)$
Staging^(staging|stage)$
Development^(dev|develop)$
Features^feature/
Hotfixes^hotfix/
Releases^release/

Environment Prefixes

EnvironmentPattern
Production^prod/
Staging^stg/
QA^qa/
Development^dev/

Version Releases

EnvironmentPattern
Production^release/v\d+\.\d+\.\d+$
Release Candidates^release/v\d+\.\d+\.\d+-rc\d+$
Beta^release/v\d+\.\d+\.\d+-beta$

Regex Symbols Reference

SymbolMeaningExampleMatches
^Start of branch name^devdev/feature ✓, my-dev
$End of branch namemain$main ✓, main-old
(?i)Case-insensitive(?i)^main$main, MAIN
.Any single characterdev.dev/, dev-, dev1
*Zero or more of previousdev.*dev, dev/feature
+One or more of previousdev.+dev/feature ✓, dev
\dAny digit (0-9)v\dv1, v2, v9
|ORdev|qadev, qa
[ ]Any character in brackets[0-9]0, 1, 2, … 9
( )Group patterns^(dev|qa)/dev/test, qa/test
[^ ]NOT in brackets[^0-9]a, b, - (not digits)

Best Practices

Do

PracticeGoodBad
Anchor at start^dev/dev/ (matches anywhere)
Use $ for exact^main$^main (matches main-old)
Test patterns firstUse regex101.comDeploy untested
Use (?i) for case(?i)^release/^[Rr][Ee][Ll]...

Avoid

PatternProblem
.*Matches everything
.+Matches any branch
dev*Matches d, de, dev
dev;echoSecurity risk (special characters)

Validation

Errors (blocks saving)

  • Invalid characters: ;, &, `, ", ', <, >, %
  • Invalid regex syntax: unclosed brackets, invalid escapes

Warnings (allows saving)

  • Unanchored patterns that might match unintentionally
  • Suggestion provided to fix

Testing Patterns

Example: ^dev/

BranchMatchReason
dev/feature-loginStarts with dev/
dev/bug-fixStarts with dev/
development/testStarts with development/
my-dev/branchDoes not start with dev/

Example: ^release/v\d+\.\d+

BranchMatchReason
release/v1.0Matches pattern
release/v2.5.3Matches pattern (and more)
release/version1.0Missing v before number
release/betaNo version number

CLI Override

Bypass branch mapping with the --environment flag:
npx tdpw upload ./playwright-report --token="..." --environment="staging"
The CLI flag takes priority over branch mapping rules. See CLI reference for details.