This endpoint allows users to apply multiple regex patterns to a given string and retrieve the matches. It can handle both single and multiple matches for each pattern specified.
URL
https://node.nodetrigger.com/multiple_regex
Method
POST
JSON Body Parameters
string
(String): The string to be searched. Default is an empty string if not provided.regexPatterns
(Array of Strings): A list of regex patterns to apply to the string. Each pattern should be formatted askey::mode::/pattern/
, where:key
(String): An identifier for the regex pattern.mode
(String): Can be eithersingle
ormultiple
. Determines if the pattern should return a single match or multiple matches.pattern
(String): The regex pattern enclosed in slashes.
Example JSON Body
{
"string": "Sample text with numbers 123 and more text 456.",
"regexPatterns": [
"numbers::multiple::/(\\d+)/",
"firstWord::single::/^\\w+/"
]
}
Responses
200 OK
: Returns a JSON object where each key is the identifier from the regex pattern and the value is the match or matches found.- If no matches are found for a pattern, the value will be
null
.
Example Requests
Request 1
JSON Body
{
"string": "The quick brown fox jumps over the lazy dog.",
"regexPatterns": [
"words::multiple::/\\b\\w+\\b/",
"firstWord::single::/^\\w+/"
]
}
Response
{
"words": ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"],
"firstWord": "The"
}
Request 2
JSON Body
{
"string": "Error: code 404. Warning: code 500.",
"regexPatterns": [
"errorCodes::multiple::/code (\\d+)/",
"firstError::single::/Error: code (\\d+)/"
]
}
Response
{
"errorCodes": ["404", "500"],
"firstError": "404"
}
Regex in Make (formerly Integromat)
When integrating regular expressions within Make (formerly Integromat), it is crucial to correctly format special characters. In many regex environments, such as Postman, two backslashes (\\
) are used to denote literal characters. However, in Make, only a single backslash (\
) is necessary.
For instance, to escape a dot (which is a special character in regex) and match it literally in an email address, use \.
instead of \\.
. This distinction is vital for ensuring the regex functions as intended within Make’s custom app environment.
For example, to extract email addresses from text, the regular expression in Postman might look like this:
([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})
In Make, the correct format would be:
([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
This format should be used when specifying regex patterns in Make to correctly extract and handle data.