sampleuserhere
Active member
For example we have the following text.
And we want to extract the text with the following regex.
Here's the information that can be retrieved based on the previous details
What I propose is a sub-action of Text Manipulation that could return those information into the following JSON object/dictionary variable.
The rules is fairly simple.
With this mechanism, I believe extracting data out of a text will become easier like how it should be with regex.
TIA.
Code:
1,one
2,two
3,three
4,four
(?<number>\d+),(?<text>[a-z]+)
Here's the information that can be retrieved based on the previous details
- Matches [ "1,one", "2,two", "3,three", "4,four" ]
- Capture group number [ "1", "2", "3", "4" ]
- Capture group text. [ "one", "two", "three", "four" ]
What I propose is a sub-action of Text Manipulation that could return those information into the following JSON object/dictionary variable.
Code:
{
"matches": [
"1,one",
"2,two",
"3,three",
"4,four"
],
"number": [
"1",
"2",
"3",
"4"
],
"text": [
"one",
"two",
"three",
"four"
]
}
The rules is fairly simple.
- Matches will be stored into matches key.
- Any named capture group will be stored under its own name. If capture group is not named, they will be stored in a key with the following name pattern "group#".
Code:
{
"matches": [
],
"group0": [
],
"group1": [
]
}
With this mechanism, I believe extracting data out of a text will become easier like how it should be with regex.
TIA.
Last edited: