Get Emp_name and Emp_id from array string

"[Employee Name: Xyz, Abc “Employee ID:01234567 IIDate Last Worked:09/12/2020"Date of Injury/lllness:NIA”

"[Employee Name: Xyz, Abc "Employee ID:01234567 “Date Last Worked:09/12/2020 Date of Injury/lllness:NIA”

Hi @basuraj.kumbhar

Welcome to forum

May I know ur query in detail

Thanks,
I want get Emp_ID and Emp_Name from given string array

below are array index in which I am getting two types of variations

arrinfo("[Employee Name: Xyz, Abc “Employee ID:01234567 IIDate Last Worked:09/12/2020"Date of Injury/lllness:NIA”)

arrinfo("[Employee Name: Xyz, Abc "Employee ID:01234567 “Date Last Worked:09/12/2020 Date of Injury/lllness:NIA”)

Is xyz,and is employee name

Yes,
I want to take out put as Xyz, Abc and 01234567

@basuraj.kumbhar
give a try on regex (Match Activity) or Regex.Match(… ) Method
with following patterns:


(?<=Employee Name:).*(?="Employee ID)


(?<=Employee ID:)\d+

with a later trim, the unneeded blanks can be removed

Also have a look here:

3 Likes

Thanks, @ppr

I tried with below,
System.Text.RegularExpressions.Regex.Match(arrOpusPDFInfo(intArrLineCounter).ToString.Trim,"(?<=Employee ID:)\d+").Value.Trim

Getting empty emp_id

@basuraj.kumbhar
set breakpoint before this activity, go debugging and show us from watch / immediate panel the value of
arrOpusPDFInfo(intArrLineCounter).ToString.Trim

@ppr

"[Employee Name: Abc, xyz Employee ID: 01234567 IIDate Last Worked: 08/14/2020 “Date of Injury/lllness: NIA”

@basuraj.kumbhar
check if the space after the Employee ID: – will do a difference:

kindly note the reworked pattern

Thanks @ppr It work… :grinning:

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