Match Stage
The Match stage is the third step in the Pipe lifecycle (after optional Setup and Condition). It is executed only if all previous Conditions have passed.
While Conditions check for structural integrity (type and size), the Match stage focuses on semantic validation - ensuring the content of the data follows a specific pattern or format.
Execution Rule
The Match stage is the bridge between "is this data the right shape?" and "is this data the right content?". It is primarily powered by Regular Expressions (Regex) and format-specific validators.
Best Practices
Combine with Conditions
Use conditions for structural validation, then match for content:
email={
"type": str,
"conditions": {Pipe.Condition.MaxLength: 64}, # Structure
"matches": {Pipe.Match.Format.Email: None} # Content
}
Use Appropriate Validators
Choose the right validator for your use case:
- Email: Use
Match.Format.Email - URL: Use
Match.Web.URL - Phone: Use
Match.Format.E164Phone - Custom patterns: Use
Match.Regex.FullMatchorMatch.Regex.Search
Regex Performance
Complex regex patterns can be slow. Test performance with realistic data:
# Simple and fast
r"^\d{5}$"
# Complex and potentially slow
r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$"
Run conditions before match to increase performance:
email={
"type": str,
"conditions": {Pipe.Condition.MaxLength: 64}, # Structure
"matches": {Pipe.Match.Format.Email: None} # Content
}
Case Sensitivity
Most match handlers are case-sensitive.
Technical Reference
The following section is automatically generated from the source code, detailing the available condition handlers and their configurations.
Match
Central registry for all match handler units.
This class provides a convenient way to access different match handlers (e.g., Text, Regex, Web) from a single location.
Source code in pipeline/handlers/match_handler/match.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
MatchEncoding
Registry for encoding-related match handlers.
Includes handlers for Base64, JSON, etc.
Source code in pipeline/handlers/match_handler/units/match_encoding.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Base64
Bases: MatchHandler[str, None]
Checks if string is valid Base64 encoded
Source code in pipeline/handlers/match_handler/units/match_encoding.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
JSON
Bases: MatchHandler[str, None]
Validates that a string is a correctly formatted JSON object or array
Source code in pipeline/handlers/match_handler/units/match_encoding.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
MatchFormat
Registry for format-related match handlers.
Includes handlers for Email, UUID, HexColor, etc.
Source code in pipeline/handlers/match_handler/units/match_format.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
E164Phone
Bases: MatchHandler[str, None]
International phone numbers in E.164 format (e.g., +1234567890)
Source code in pipeline/handlers/match_handler/units/match_format.py
55 56 57 58 59 60 61 62 63 64 65 66 | |
Email
Bases: MatchHandler[str, None]
Accepts email addresses with standard user, domain, and TLD parts
Source code in pipeline/handlers/match_handler/units/match_format.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
HexColor
Bases: MatchHandler[str, None]
Accepts hex colors in 3 or 6 digit formats (e.g., #F00, #FF0000)
Source code in pipeline/handlers/match_handler/units/match_format.py
43 44 45 46 47 48 49 50 51 52 53 | |
JWT
Bases: MatchHandler[str, None]
Validates the structure of a JSON Web Token (header.payload.signature)
Source code in pipeline/handlers/match_handler/units/match_format.py
115 116 117 118 119 120 121 122 123 124 | |
Password
Bases: MatchHandler[str, str]
Validates password strength based on three policies: RELAXED, NORMAL, or STRICT.
Policies: - RELAXED: 6-64 chars, 1 uppercase, 1 lowercase. - NORMAL: 6-64 chars, 1 uppercase, 1 lowercase, 1 digit. - STRICT: 6-64 chars, 1 uppercase, 1 lowercase, 1 digit, 1 special character.
Requires a policy argument (e.g., Match.Format.Password.NORMAL)
Source code in pipeline/handlers/match_handler/units/match_format.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
UUID
Bases: MatchHandler[str, None]
Validates 36-character hexadecimal unique identifiers (8-4-4-4-12)
Source code in pipeline/handlers/match_handler/units/match_format.py
32 33 34 35 36 37 38 39 40 41 | |
MatchLocalization
Registry for localization-related match handlers.
Includes handlers for Country, Currency, Language (ISO codes), and Timezones.
Source code in pipeline/handlers/match_handler/units/match_localization.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
Country
Bases: MatchHandler[str, None]
ISO 3166-1 alpha-2 (e.g., 'US', 'DE', 'JP')
Source code in pipeline/handlers/match_handler/units/match_localization.py
18 19 20 21 22 23 24 25 26 27 28 29 | |
Currency
Bases: MatchHandler[str, None]
ISO 4217 (e.g., 'USD', 'EUR', 'BTC')
Source code in pipeline/handlers/match_handler/units/match_localization.py
31 32 33 34 35 36 37 38 39 40 41 | |
Language
Bases: MatchHandler[str, None]
ISO 639-1 (e.g., 'en', 'fr', 'zh')
Source code in pipeline/handlers/match_handler/units/match_localization.py
43 44 45 46 47 48 49 50 51 52 53 | |
Timezone
Bases: MatchHandler[str, None]
IANA Timezone (e.g., 'America/New_York', 'Europe/London')
Source code in pipeline/handlers/match_handler/units/match_localization.py
55 56 57 58 59 60 61 62 63 64 65 66 | |
MatchNetwork
Registry for network-related match handlers.
Includes handlers for IPv4, IPv6, MAC Addresses, etc.
Source code in pipeline/handlers/match_handler/units/match_network.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
IPv4
Bases: MatchHandler[str, None]
Validates a standard IPv4 address (e.g., '192.168.1.1')
Source code in pipeline/handlers/match_handler/units/match_network.py
15 16 17 18 19 20 21 22 23 24 25 | |
IPv6
Bases: MatchHandler[str, None]
Validates an IPv6 address (e.g., '2001:db8::ff00:42:8329')
Source code in pipeline/handlers/match_handler/units/match_network.py
27 28 29 30 31 32 33 34 35 36 37 | |
MACAddress
Bases: MatchHandler[str, None]
Accepts hardware MAC addresses using colon, hyphen, or dot separators
Source code in pipeline/handlers/match_handler/units/match_network.py
39 40 41 42 43 44 45 46 47 48 49 50 | |
MatchRegex
Registry for regex-related match handlers.
Includes handlers for Search and FullMatch.
Source code in pipeline/handlers/match_handler/units/match_regex.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
FullMatch
Bases: MatchHandler[str, str | Pattern]
Accepts values that match the provided regex pattern in their entirety
Source code in pipeline/handlers/match_handler/units/match_regex.py
28 29 30 31 32 33 34 35 36 37 38 39 | |
Search
Bases: MatchHandler[str, str | Pattern]
Accepts values that contain at least one match of the provided regex pattern
Source code in pipeline/handlers/match_handler/units/match_regex.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
MatchText
Registry for text-related match handlers.
Includes handlers for Lowercase, Uppercase, Digits, etc.
Source code in pipeline/handlers/match_handler/units/match_text.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
Alphanumeric
Bases: MatchHandler[str, None]
Accepts letters and numeric digits. No symbols or spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
109 110 111 112 113 114 115 116 117 118 119 | |
AlphanumericWithSpaces
Bases: MatchHandler[str, None]
Accepts letters, numeric digits, and spaces. No symbols
Source code in pipeline/handlers/match_handler/units/match_text.py
121 122 123 124 125 126 127 128 129 130 131 132 | |
Digits
Bases: MatchHandler[str, None]
Accepts ONLY numeric digits (0-9)
Source code in pipeline/handlers/match_handler/units/match_text.py
85 86 87 88 89 90 91 92 93 94 | |
DigitsWithSpaces
Bases: MatchHandler[str, None]
Accepts numeric digits (0-9) and spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
96 97 98 99 100 101 102 103 104 105 106 107 | |
Letters
Bases: MatchHandler[str, None]
Accepts ONLY case English letters (a-z, A-Z)
Source code in pipeline/handlers/match_handler/units/match_text.py
61 62 63 64 65 66 67 68 69 70 | |
LettersWithSpaces
Bases: MatchHandler[str, None]
Accepts English letters (a-z, A-Z) and spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
72 73 74 75 76 77 78 79 80 81 82 83 | |
Lowercase
Bases: MatchHandler[str, None]
Accepts ONLY lowercase English letters (a-z)
Source code in pipeline/handlers/match_handler/units/match_text.py
13 14 15 16 17 18 19 20 21 22 | |
LowercaseWithSpaces
Bases: MatchHandler[str, None]
Accepts lowercase English letters (a-z) and spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
24 25 26 27 28 29 30 31 32 33 34 35 | |
NoWhitespace
Bases: MatchHandler[str, None]
Ensures string contains no spaces, tabs, or line breaks
Source code in pipeline/handlers/match_handler/units/match_text.py
147 148 149 150 151 152 153 154 155 156 157 | |
Printable
Bases: MatchHandler[str, None]
Accepts letters, numbers, symbols, and spaces (ASCII 20-7E)
Source code in pipeline/handlers/match_handler/units/match_text.py
134 135 136 137 138 139 140 141 142 143 144 145 | |
Slug
Bases: MatchHandler[str, None]
URL-friendly strings: 'my-cool-post-123'
Source code in pipeline/handlers/match_handler/units/match_text.py
159 160 161 162 163 164 165 166 167 168 169 170 | |
Uppercase
Bases: MatchHandler[str, None]
Accepts ONLY uppercase English letters (A-Z)
Source code in pipeline/handlers/match_handler/units/match_text.py
37 38 39 40 41 42 43 44 45 46 | |
UppercaseWithSpaces
Bases: MatchHandler[str, None]
Accepts uppercase English letters (A-Z) and spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
48 49 50 51 52 53 54 55 56 57 58 59 | |
MatchTime
Registry for time-related match handlers.
Includes handlers for Date, Time, and DateTime (ISO 8601).
Source code in pipeline/handlers/match_handler/units/match_time.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Date
Bases: MatchHandler[str, None]
Validates YYYY-MM-DD format
Source code in pipeline/handlers/match_handler/units/match_time.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
DateTime
Bases: MatchHandler[str, None]
Validates ISO 8601 combined Date and Time (e.g., 2023-10-01T14:30:00Z).
Source code in pipeline/handlers/match_handler/units/match_time.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Time
Bases: MatchHandler[str, None]
Validates 24h time in HH:MM or HH:MM:SS format
Source code in pipeline/handlers/match_handler/units/match_time.py
28 29 30 31 32 33 34 35 36 37 38 | |
MatchWeb
Registry for web-related match handlers.
Includes handlers for Domain and URL.
Source code in pipeline/handlers/match_handler/units/match_web.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
Domain
Bases: MatchHandler[str, None]
Validates a domain name based on RFC 1035.
Source code in pipeline/handlers/match_handler/units/match_web.py
14 15 16 17 18 19 20 21 22 23 24 25 | |
URL
Bases: MatchHandler[str, None]
Validates web URLs using HTTP or HTTPS protocols.
Source code in pipeline/handlers/match_handler/units/match_web.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |