Extract only the login and password from a string

Hello all,
I need help to extract a specific login and password from text string :

My Inpute String after displayind it with a WriteLine activity it’s like the below:
\t\t\t\t \t\t\t\t\t\t \t \t \t\t\t\t \t\tAdditional credentials, to enter in specific popup box when prompted for authentication.username: in_UsernamePassword: in_Password \t\t \t\t\t\t\t \t\t\t\t\t \t\t\t \t\t\t \t\t\t \t\t\t\t \t\t\t\t \t\t\t"

My desired outputs is the :

  • in_Username
  • in_Password

Thank’s

hi @o.mustapha- Please try this…

Pattern for UserName: (?<=username: )\w+(?=P)
Pattern for Password: (?<=Password: )\w+

1 Like

please could you provide me the right syntax to implement in a assign activity

This will work only if username is without any spaces and password does not contain any special characters.

You have to use Matches activity where Input will be your Input variable i.e. text
In Pattern pass the regex
and output you will have collection of matches based on the input

@KannanSuresh -Agree… I have provided the regex pattern based on the user Input…You can bring n no.of assumptions into this…Assuming all those and writing the pattern is tough

1 Like

Might be the case with password. However, for username, the below pattern should work.

(?<=username: ).*(?=Password: )

Well it’s working now !!

thanks a lot

Best Regards

1 Like

@o.mustapha - Like this.

StrOutput = System.Text.RegularExpressions.Regex.Match("\t\t\t\t \t\t\t\t\t\t \t \t \t\t\t\t \t\tAdditional credentials, to enter in specific popup box when prompted for authentication.username: in_UsernamePassword: in_Password \t\t \t\t\t\t\t \t\t\t\t\t \t\t\t \t\t\t \t\t\t \t\t\t\t \t\t\t\t \t\t\t","(?<=username: )\w+(?=P)").Value

@o.mustapha - If you see any issues, you can adjust it as @KannanSuresh mentioned…

Thank’s all. my data manipulation work fine now, I apreciate all your helps

Best Regards

1 Like

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