Hello all
I am starting with RegEx and have difficulty with RegEX parsing
I have UK address and need to parse out road number and postcode (US zip) for is AA## #AA
I have been able to parse out the number using (\d+)
I have been able to postcode out the number using ([[:alpha:]]{2}\d{2}\s\d[[:alpha:]]{2})
done these individually but can't do it on the same REGex tool, is there a or operator
what am i missing?
also, how do I get the road name to be parsed?
How can i use the Regex match to identify if data doesnt have a postcode?
MAny thanks
Denny
Solved! Go to Solution.
Hi @DennyChan
You are almost there. You just need to provide multiple groups in regex expression to parse out multiple fields. Ex. One group for road number, one group for zip code and vice versa.
Number of output fields = Number of capturing groups (Non capturing groups will be excluded)
You can refer below configuration for your reference. And regarding road name, I did not find any road name in data.
@Amol_Telore Though not point in capturing a group and then ignoring it. You might as well replace (?:.*) with .*
Thanks @Amol_Telore
The address I am referring to is the words "address, another address and long long address" everything between the house number and postcode, need to parse as street name
many thanks
Denny
@DennyChan You can use below regex to parse all three information in parse mode.
Regex Expression :-
(\d+)\s+(.*?)\s+(\w{2}\d{2}.*)
@PhilipMannering I tried your suggestion. Thanks for showing me this approach.!
Hi @DennyChan ,
It's possible to extract both from one RegEx tool.
The main problem in yours is that the number at start of string is not recognized.
I re-edited your regex a bit to make it work.
To extract them, you put them in parentheses as you did before.
(^[0-9]+)\s.+([[:alpha:]]{2}\d{2}\s\d+[[:alpha:]]{2})
Cheers !
You might find this site useful:
https://regexlib.com/Search.aspx?k=Uk%20postcode
better to find success in other peoples efforts
cheers,
mark