-1

I'm trying to extract the company name from these text strings in Google Sheets. However, I can't get my head wrapped around regular expressions and regexextract.

Strings:

S-1 - Wealthbridge Acquisition Ltd (0001753673) (Filer)
S-1/A - KinerjaPay Corp. (0001494162) (Filer)
S-1 - CYTY CAPITAL SOLUTIONS INC (0001762609) (Filer)
S-1/A - NORTHWEST OIL & GAS TRADING COMPANY, INC. (0001762533) (Filer)

Intended result:

Wealthbridge Acquisition Ltd
KinerjaPay Corp.
CYTY CAPITAL SOLUTIONS INC
NORTHWEST OIL & GAS TRADING COMPANY, INC.

I've tried reading the Google Sheets documentation on REGEXExtract and many other sources, but none of it makes sense. I would turn to YouTube but unfortunately that's blocked at work. Thanks in advance community!

I tried this: =REGEXEXTRACT(A2,"\s(.*)(") which is getting closer but I still have no clue what I'm doing.

EDIT: Holy macaroni I figured it out! I'm not sure how it works, but it works.

=REGEXEXTRACT(A2,"\s(\w.*)\(0")

1 Answers1

1

Assuming all follows that pattern ( dash name of company (number) ) the following works using REGEXEXTRACT.

=REGEXEXTRACT(A2; "-\s([^\(]+)")

My goal was to match the dash, after the space (\s) and after that GROUP everything one or more times until i found a parenthesis on the string.

Also, i used regex101 to verify the pattern and made it work on google sheet.

lucas_7_94
  • 326
  • 3
  • 9
  • I saw you edited your post, want to clarify your code will work except if the first number on the parenthesis isn't zero so, be carefull with that. – lucas_7_94 Dec 27 '18 at 23:31