Vito
September 9, 2022, 11:06am
1
Hello there!
Im making an automation but i got a problem with extracting words.
To be exact I need everything after city in this response:
“Country: Netherlands (NL)
State: Zuid-Holland
City: Leidschendam-Voorburg”
Do any of you guys know how to fix this problem?
Hi @Vito
This can be done using Regex. See here for some examples:
In regular cases it’s very usefull to use Regex (or Regular Expressions) if you want to extract or replace data in some text. When there always is a similar pattern in your text data, regex is ideal to use. But how can you use regex?
What is a Regex?
Here an addition of @alex.newpath :
First, a regex is a text string. For instance, foo is a regex. So is [A-Z]+:\d+.
Those text strings describe patterns to find text or positions within a body of text. For instance, the regex foo matches the str…
Cheers
Gijs
How does this work for you? Capture group 1 will have your city. It uses the lookbehind for City: followed by 0 or 1 white space character
(?<=City:\s?)(.*)
1 Like