I'm playing with the "big" league now! Playing with regular expression!
Anyway I'm not sure if this is possible with EspoCRM, anyone do something similar or have the knowledge?
I got a street address like so:
123 Main Street, Suburb City 2000
Style as
[Street number Street name and Street type], [City name] [Postal code]
Using the regex I found online like so I can get all data in different group like so: (tested with https://regex101.com/)
Regex Code
Test Data:
As you can see it is working and it have separate the data into different group
Now what I want to do next using the formula is this:
adddressStreet = (group1)
addressCity = (group2)
For example:
addressStreet = '123 Main'
Formula wise it will look something like this:
formulaHelper is just a custom field so I can paste data and it "extract" data for me.
Of course the example above will not work! Because I don't know the correct code.
And here I am, asking. Thank you.
--- some more screenshot for reference
My failure:
Anyway I'm not sure if this is possible with EspoCRM, anyone do something similar or have the knowledge?
I got a street address like so:
123 Main Street, Suburb City 2000
Style as
[Street number Street name and Street type], [City name] [Postal code]
Using the regex I found online like so I can get all data in different group like so: (tested with https://regex101.com/)
Regex Code
Code:
/\b(\d+\s+[\w\s]+)\s*,?\s*(\b(?:Road|Street|Avenue|Lane|Drive|Boulevard|Crescent|Court|Place|Terrace|Highway|Parade|Close|Grove|Way|Walk|Esplanade))\b(?:\s*,\s*)?(\b[A-Z][a-z]+\b(?:\s+[A-Z][a-z]+\b)*)?\s*(\b\d{4})\b/
Code:
123 Main Street, Suburb City 2000
Now what I want to do next using the formula is this:
adddressStreet = (group1)
addressCity = (group2)
For example:
addressStreet = '123 Main'
Formula wise it will look something like this:
Code:
output\printLine( ifThen(formulaHelper!=null, addressStreet=string\match(formulaHelper, '/RegEX Group 1 here/'); addressCity=string\match(formulaHelper, '/RegEX Group 3 here/')
Of course the example above will not work! Because I don't know the correct code.
And here I am, asking. Thank you.
--- some more screenshot for reference
My failure:
Comment