Hi all, I get some data like below and put it in to a string
License holder Assad
Licensed Address Erdington UK
Reference Number 054504
Expiry Date 20/04/2019
(deliberate empty line for my example)
Other licence number 2644646
I then use this in an assign ‘ExtractedData.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)’
to put it in to an array of strings
If I then want the ‘Other licence number’ I would use ‘ExtractedDataArray(4).ToString’ in an assign to return ‘Other licence number 2644646’ I could then use split by a " " delimiter to isolate the number of 2644646
I recognise referencing the row of array would be problematic if position changes like in the example below
License holder Smith
Licensed Address Erdington UK
Reference Number 784746
Expiry Date 20/07/2019
Over 65? Yes
Other licence number 2644646
‘Other licence number’ is now row 5.
How would I overcome this? I’m guessing I would need to write sort some of ‘expression’ that gets the ‘row’ with the text ‘Other licence number’ in but I don’t know how to do this (or use a different method if that is better)
Please can I ask what RegexResult(0).Groups(1).Value is referencing (why do you have you use .groups(1).value?
I’m guessing that if the data didn’t have any structured information to reference against (i.e it doesn’t have ‘field names’) that it would be really difficult to get the information you want because it would be different for every customer?
Assad
Erdington UK
054504
20/04/2019
(deliberate empty line for my example)
264464
When you use Matches activities it returns Array of results, hence the RegexResult(0)
When you try this regex that I’ve built you select the whole :
Other licence number 2644646
And the first capturing group is
2644646
That is why I use .Groups(1).
I’m sure that you can make regex just for the numbers but this one was just quick thought.
For the last example, yes it would be difficult to select the exact number that you want but not impossible (Remember regex is good when there is some type of rules). So if your desired number was always in the last row you might use something like this :
(\d{6})$ then select RegexResult(1) (because it selects the 0 group as well the 054504), it depends on the pattern