Extraction of 10 Character After Particular Word

Hi Everyone,

Thanks for your help in Advance,

I have a string of Array in which I want to extract the 10 character after “ORG=” or “COMPANY NAME”.

Please help me to extract the 10 character after ORG= or COMPANY NAME:.

strArray={

"Lorem Ipsum is simply dummy text of the printing and typesetting

industry. Lorem Ipsum has been the industry’s standard dummy

of type and scrambled it to make a type specimen book. It has

survived not only five centuries, but also the leap into electronic OR

G=MICROSOFT CORP typesetting, remaining essentially unchanged. It was

popularised in the 1960s with the release of Letraset sheets containing Lorem" ,

"It is a long established fact that a reader will be distracted b

y the readable content of a page when looking at its layout. The po

int of using Lorem Ipsum is that it has a more-or-less normal distribution ORG=IDEA P

VT LTD of letters, as opposed to using 'Content here, content here" ,

"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris

vestibulum accumsan lacinia. Fusce et mattis sem, id malesuada mauris. COMPANY

NAME:UIPATH INC Suspendisse venenatis, tortor ut lacinia laoreet, purus libero sodales"

"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris

vestibulum accumsan lacinia. Fusce et mattis sem, mauris.ORG=PANIC

CORPORATION Suspendisse venenatis, tortor ut lacinia laoreet, purus libero urna"

}

Please Check the attached file for viewing the input String Array.

InputStrArray.docx (12.9 KB)

@J0ska

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Match(item.Replace(vbcr,"").Replace(vblf,""),"(?<=ORG|COMPANY\s*NAME)[\s\S]{10}").value

Regards,

Thank you so much for your reply!
It is working fine for other cases but except for the 1 case.

Case:
“Lorem ipsum dolor sit amet, consectetur adipis OR\r\nG=NOKIA SOLUTIONS ccumsan lacinia. Fusce et mattis sem”
(This is the text which I got when I print the particular string of that array).

Hi,

In this case, we need to get rid of \r\n, so can you try the following?

System.Text.RegularExpressions.Regex.Match(item.Replace(vbcr,"").Replace(vblf,"").Replace("\r\n",""),"(?<=ORG|COMPANY\s*NAME)[\s\S]{10}").value

Regards,

Thank you so much @Yoichi :star_struck: .

Your solution completly solved my question.

1 Like

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