Extract Words from a text

Hello,

I’m truyin to extract the word between “Code IFLS” and “Rgpt” in following text:

“Code IFLS : K66842 3607381018012 DVD OP 4 DVD=20 RENTREE BOX 12 Rgpt : 00”

i’m using: text.Substring(text.IndexOf(“Code IFLS”)+9, ((text.IndexOf(“Code IFLS”)+9)-(text.IndexOf(“Rgbt”)+4)) )

but it gives a wrong word

1 Like

Hi
Try using regex.

Regards,
Pavan

with which patterns?

Hi,
Try this (?<=(Code IFLS).\s[:]).(?=(Rgpt))

use a matches activity and then give this pattern and then the output will be of INumberable collection
so to get the matched value use the below code
MatchesOutPutVariable.cast(of Object).First.tostring

Let us know if this helps.

Regards,
Pavan H

i tryed it:

but got the following error: sequence contain no element

Hi @abdel,

Use the below regular expression

(?<=IFLS :)(.+?)(?=Rgpt)

You can test the above in regex101.com

Import System.text.regularexpressions

Use an assign statement

Basically the syntax is Regex.match(Inputstring, Pattern)

Regex.match(“Code IFLS : K66842 3607381018012 DVD OP 4 DVD=20 RENTREE BOX 12 Rgpt : 00”,“?<=IFLS :)(.+?)(?=Rgpt)”).tostring

Store the above output in string variable

image

2 Likes

Thanks anil it works :slight_smile:

i had an Urgent matter: a treatement that need to be done on the following screen;
image
type into x and send hotkey “enter” in the ligne corresponding to “03032000”
after that other screen will appear and other treatment is done

right now i’m able to do that on the First ligne but i need to do the treatment for every lignes where “03032000” appear. Etape 8.xaml (134.8 KB)

attached is tha workflow,

Hello have anybody any idea

Your workflow is very difficult to follow.

Are you saying you want to add a new line everytime the code “03032000” appears in the data you presented above?

So:

03032000 87946902
K66842 01 3607381018012 PBA

Becomes

03032000 87946902

K66842 01 3607381018012 PBA

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.