cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Text with NewLine

NiklasFranke
Level 5
Hello,

i have a text like this
35263.pngand want to extract the text after ":".
The length of the extractet text can variate. My Idea was to do this with the Mid Function like this 35264.png35265.pngbut the the length is not right. I think that im using the Newline Character wrong.
I can solve the problem with 
35266.pngBut this will not work  for the last entry cause i dont have a word after it like "Datum:"
I mean, i can spilt the text with NewLine() in a collection, but there must be an easier way..
10 REPLIES 10

Soumya21
Level 6
Hi @Niklas Franke

Try using Extract Text Field action ​from Utility Strings and give inputs pretext and post text.
For your question pretext would be Messobjekt: and post text would be Datum

Thanks,
Soumya

EslamGhandour
Level 4
Hi @Soumya21 I believe this action you're mentioning is a costumed action as it's not originally in the VBO. You can find that in the documentation of the VBO on Digital Exchange following this link. Utility - Strings

Hi, ​@NiklasFranke please check this thread String Manipulation-Fetch data in between the string | Blue Prism Product the question is identical to yours. If you are familiar with regex multiple answers available there achieving it.
I also provided an answer there that does not use regex and work with basic actions in BP.

Hope this is helpful.​

Soumya21
Level 6
Hi @EslamGhandour
Yes, its costumed action
I have attached Extract Field Action Page which you can add in Utility String VBO and use according to your requirement

Hope this helps,

Thanks,
Soumya 

MichealCharron
Level 8
@NiklasFranke

This is very similar to String Manipulation-Fetch data in between the string | Blue Prism Product. You could use the same instructions I provided for that answer with the following Regex pattern:
Messobjekt:\s(?<Messobjekt>.*)[\r\n]+Datum:\s(?<Datum>.*)[\r\n]+QS-Nummer:\s(?<QSNummer>.*)[\r\n]+Seriennummer:\s(?<Seriennummer>.*)[\r\n]*​

​You would end up with an output collection like:
35245.png
Micheal Charron
RBC
Toronto, Ontario
Canada

NiklasFranke
Level 5
Hello together and thank you all for your help.

@MichealCharron sadly, im dont have "Extract Regex All Matches" but i have "Extract Regex Values" what should also work.
I tryed it like this:35247.png35248.png35249.png
But i had to add the Field "Name" and "Value" to the collection to made it work and now i just get this...35250.png

NiklasFranke
Level 5
Okay i almost got it at least for the first word.
35253.png
35254.png But it looks that the [\r\n]+ is beeing ignored.
35255.png

NiklasFranke
Level 5
Hello all,

unbelievable but i tried ChatGPT and it solved my Regex Problem.. has to be "Messobjekt:\s(?<ExpectedText>[^\r\n]*)"

Anyway thank you very much for the help.

MichealCharron
Level 8
@NiklasFranke

For the "Extract Regex Values" action, you need to specify the names of the capture groups. In the Regex pattern​ the name of the capture group is denoted by ?<capture group name>. In the case of the Regex pattern I specified above, the "Named Values" input collection should look like:
35261.png

The only problem with the "Extract Regex Values" action is that it is very cumbersome to retrieve the individual values from the output collection because they are on separate rows:
35262.png
Blue Prism's newer "Utility - Strings" VBO, with the "Extract Regex All Matches" action, can be downloaded from their Digital Exchange site at:
Utility - Strings : Blue Prism Digital Exchange
Micheal Charron
RBC
Toronto, Ontario
Canada

NiklasFranke
Level 5
Hello @MichealCharron

somehow my IT was really fast and added the new VBO..Thought that would take 1-2 weeks. I got it right with "Messobjekt:\s(?<Messobjekt>.*)[\r\n]+Datum:\s(?<Datum>.*)[\r\n]+QS-Nummer:\s(?<QSNummer>.*)[\r\n]+Seriennummer:\s(?<Seriennummer>.*)[\r\n]"

But it would not work at first because the "-" in "QS-Nummer" seemed to be another type of line.. unbeliveable.. solved it trough copying the word into the Regex.

Thanks a lot, the extraction with they new VBO is way easyier like you said.