Hi,
I receive the following input John P Maria Do Fred T
I would like to receive the following output each being it’ own value. how can I do that ?
John P
Maria Do
Fred T
Hi,
I receive the following input John P Maria Do Fred T
I would like to receive the following output each being it’ own value. how can I do that ?
John P
Maria Do
Fred T
Welcome to the Make community!
Are those names, and how do we know whether we should split the names that way instead of this?
John P Maria
Do Fred T
samliew – request private consultation
Join the unofficial Make Discord server to chat with us!
Hi, Yes they are names
The format in which they come is First name + Last name (1 or 2 letters) All of those separated by spaces.
The format for output Must be: First name [Space] Last name letters, then next value same thing.
like the example below.
John P
Maria Do
Fred T
Thanks for the clarification.
Welcome to the Make community!
You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):
(?<name>\w+\s\w{1,2})
Proof https://regex101.com/r/ZU6bmA/1
For more information, see Text Parser in the Make Help Center:> Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.
- The complete list of metacharacters can be found on the MDN web docs website.
- For a tutorial on how to create regular expressions, we recommend the RegexOne website.
- For an easy, quick regex generator, try the Regular Expressions generator.
- For experimenting with regular expressions, we recommend the regular expressions 101 website. Just make sure to tick the ECMAScript (JavaScript) FLAVOR in the left panel.
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.
JSON - Copy and Paste this directly in the scenario editor
{
"subflows": [
{
"flow": [
{
"id": 116,
"module": "util:ComposeTransformer",
"version": 1,
"parameters": {},
"mapper": {
"value": "John P Maria Do Fred T"
},
"metadata": {
"designer": {
"x": 1713,
"y": -1311
},
"restore": {},
"expect": [
{
"name": "value",
"type": "text",
"label": "Text"
}
]
}
},
{
"id": 118,
"module": "regexp:Parser",
"version": 1,
"parameters": {
"pattern": "(?<name>\\w+\\s\\w{1,2})",
"global": true,
"sensitive": true,
"multiline": false,
"singleline": false,
"continueWhenNoRes": false,
"ignoreInfiniteLoopsWhenGlobal": false
},
"mapper": {
"text": "{{116.value}}"
},
"metadata": {
"designer": {
"x": 1954,
"y": -1310,
"messages": [
{
"category": "last",
"severity": "warning",
"message": "A transformer should not be the last module in the route."
}
]
},
"restore": {
"parameters": {
"sensitive": {
"collapsed": true
},
"multiline": {
"collapsed": true
},
"singleline": {
"collapsed": true
},
"continueWhenNoRes": {
"collapsed": true
}
}
},
"parameters": [
{
"name": "pattern",
"type": "text",
"label": "Pattern",
"required": true
},
{
"name": "global",
"type": "boolean",
"label": "Global match",
"required": true
},
{
"name": "sensitive",
"type": "boolean",
"label": "Case sensitive",
"required": true
},
{
"name": "multiline",
"type": "boolean",
"label": "Multiline",
"required": true
},
{
"name": "singleline",
"type": "boolean",
"label": "Singleline",
"required": true
},
{
"name": "continueWhenNoRes",
"type": "boolean",
"label": "Continue the execution of the route even if the module finds no matches",
"required": true
},
{
"name": "ignoreInfiniteLoopsWhenGlobal",
"type": "boolean",
"label": "Ignore errors when there is an infinite search loop",
"required": true
}
],
"expect": [
{
"name": "text",
"type": "text",
"label": "Text"
}
],
"interface": [
{
"type": "text",
"name": "name",
"label": "name"
},
{
"type": "uinteger",
"name": "i",
"label": "i"
},
{
"type": "any",
"name": "__IMTMATCH__",
"label": "Fallback Match"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}
Hope this helps! Let me know if there are any further issues!
samliew – request private consultation
Join the Make Fans Discord server to chat with other makers!
Thank you very much. that was really helpful
No problem, glad I could help!
1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.
2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.
This marks the topic as solved, so that:
To do this, simply click the checkbox at the bottom of the post that answers your question:
3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!
4. Do join the unofficial Make Discord server for live chat and video assistance
Hope this helps! Let me know if there are any further questions or issues.
samliew – request private consultation
Join the Make Fans Discord server to chat with other makers!