How to split text when I use read pdf and got output in the same line


How to split text in item 6. and item 7.

Hi @poominkajornsakda

Can you try to Read the pdf by setting PreserveFormatting option as True?

Regards,

@poominkajornsakda

for this you can use regex to split the data

for this follow below steps

1.Take one assign activity
2. Create Matchcollection(variable type) variable and add that variable in TO section in assign activity.
3. In value section give below syntax,
Syste.Text.RegularExpressions.Regex.Matches(yourstringvar, “\d+.\s*[^0-9]+”))
4. Here you will get list values where it got separted as per your scenario, you can call those value by using index or loop

If you find it helpful, please check this post as solution.

Happy Automation!!

I tried but get same solution.

@poominkajornsakda

did you tried this

@poominkajornsakda

for this you can use regex to split the data

for this follow below steps

1.Take one assign activity
2. Create Matchcollection(variable type) variable and add that variable in TO section in assign activity.
3. In value section give below syntax,
Syste.Text.RegularExpressions.Regex.Matches(yourstringvar, “\d+.\s*[^0-9]+”))
4. Here you will get list values where it got separted as per your scenario, you can call those value by using index or loop

If you find it helpful, please check this post as solution.

Happy Automation!!

I trying but when I call Section6 = matchCollection(5).Value.ToString.Trim() it in the same line too.

Can you elaborate more please, what happening after calling section 6.. what is your exact input, if possible send your input as text in this thread


@poominkajornsakda

What you expecting output from that.

and paste your input data as text not in the image

Try to use this below regex:
Regex.Match(yourText,“6.\s(.?)(?=\s7.)”,RegexOptions.Singleline).Value

Mark solution if its help happy Automation :blush: