Regex to ignore data after staring point and endpoint

How do we remove or filter data using regex to remove data after an in between ? The starting point is the first date (date could be dynamic it is no the fixed) so for example 08/03/2020 and the endpoint is the last 3 in capslock string (which is also dynamic but only up to 3 characters in capital letters) for example TRU in the string below. And should ignore or remove all the data after that

This is to be remove since this is already after the 08/03/2020 and TRU.

Any idea how we can design a regex for this one ? thank you.
#data to be remove

  Processing
       Co-Applicant
       No inquiry records found."

#The String

"08/03/2020        NOVUS HOME                  Mortgage Company                                                     TRU
                     MORTGAGE
   07/08/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
   07/08/2020        FCTUALDATA                                                                                       EFX
   07/08/2020        NOVUS HOME                  Mortgage Company                                                     TRU
                     MORTGAGE
   07/07/2020        CROSSCOUNTRY                Mortgage Loan                                                        TRU
                     MORTGAG
   07/07/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
   07/07/2020        FCTUALDATA                                                                                       EFX
   05/21/2020        CAP ONE NA                  Bank Credit Card                                                     XPN
   05/21/2020        CAPITAL ONE                 Credit Card                                                          TRU
   05/21/2020        CAPITALONE                  Bank                                                                 EFX
   05/20/2020        CROSSCOUNTRY                Mortgage Loan                                                        TRU
                     MORTGAG
   05/20/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
   05/20/2020        FCTUALDATA                                                                                       EFX
   05/20/2020        FINGERHUT/WEBBANK           Finance Company                                                      XPN
   05/07/2020        EMS                                                                                              EFX
   05/07/2020        GROW FINANCIAL CREDI        Credit Bureau/Mortgage                                               TRU
                                                 Processing
   Co-Applicant
   No inquiry records found."

#Expected output

   "08/03/2020        NOVUS HOME                  Mortgage Company                                                     TRU
                         MORTGAGE
       07/08/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
       07/08/2020        FCTUALDATA                                                                                       EFX
       07/08/2020        NOVUS HOME                  Mortgage Company                                                     TRU
                         MORTGAGE
       07/07/2020        CROSSCOUNTRY                Mortgage Loan                                                        TRU
                         MORTGAG
       07/07/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
       07/07/2020        FCTUALDATA                                                                                       EFX
       05/21/2020        CAP ONE NA                  Bank Credit Card                                                     XPN
       05/21/2020        CAPITAL ONE                 Credit Card                                                          TRU
       05/21/2020        CAPITALONE                  Bank                                                                 EFX
       05/20/2020        CROSSCOUNTRY                Mortgage Loan                                                        TRU
                         MORTGAG
       05/20/2020        FACTUAL DATA                Mortgage Reporter                                                    XPN
       05/20/2020        FCTUALDATA                                                                                       EFX
       05/20/2020        FINGERHUT/WEBBANK           Finance Company                                                      XPN
       05/07/2020        EMS                                                                                              EFX
       05/07/2020        GROW FINANCIAL CREDI        Credit Bureau/Mortgage                                               TRU
1 Like

@Jelrey I am not exactly sure about the regex expression I have derived in this, but you can confirm if it works for you :

3 Likes

Can we set a dynamic 3 capital letters character sir for example like TRU instead of the word Processing ?

Can we set the last TRU from the string instead of the word processing ?

So the last 3 Capital letter is a constant term always and the Word Processing isn’t ?

1 Like

yeah the string always end up with a 3 capital letters characters Like TRU , XPN etc , but Processing is not.

@supermanPunch do you think its possible ?

@Jelrey Actually, I am still trying to get the proper regex :sweat_smile: , currently no proper one. But I have one which might not be result that you need as the condition may vary sometimes, and you have to do some processing after that .Check the below regex:

1 Like

Hello @Jelrey

still working on a pattern :blush:

Cheers

Steve

@Steven_McKeering regex101: build, test, and debug regex

Hello

I’ll check the above.

In the meantime - check this pattern out.

Cheers

Steve

1 Like

Hello

What’s this sample?

Cheers

Steve

1 Like

Sir what if for this one ? regex101: build, test, and debug regex can that regex handle that too ? same logic applied

Hello

It can’t :frowning:

You need everything from after XPN deleted yes?

Cheers

Steve

1 Like

Its okay Sir , thanks for all the help , much appreicated hehe . You rock hehe

1 Like

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