Regex to extract data ahead of text

Return true if there is a text before Signatory attests , before Signatory but should not include space but only inline with Signatory

Current regex: (.*)(?=\s?Signatory|attests)

#Data Input


to execute Form 4506-C on behalf of the taxpayer. Note: This form must be received by IRS within 120 days of the signature date.

asdas Signatory attests that he/she has read the attestation clause and unon so reading declares that he/she has the authority to sign the

Form 4506-C. See instructions.

Output: True
since there is asdas before Signatory attests

#Data input Sample 2


to execute Form 4506-C on behalf of the taxpayer. Note: This form must be received by IRS within 120 days of the signature date.

Signatory attests that he/she has read the attestation clause and unon so reading declares that he/she has the authority to sign the

Form 4506-C. See instructions.

False : no inline text before Signatory

#Data Input 3



to execute Form 4506-C on behalf of the taxpayer. Note: This form must be received by IRS within 120 days of the signature date.

X Signatory attests that he/she has read the attestation clause and unon so reading declares that he/she has the authority to sign the

Form 4506-C. See instructions.

output : true , there is a character before Signatory

1 Like

The Regex is fine.
So to check if regex is returning something or not you can do it by Match Activity which will give you the Result in Boolean i.e. True or False

One example is this one , it should not include the text at the top

Try with this Regex
(.*)(?=Signatory)

it is wrong , I tried it , your regex return TRUE on the text above instead of false

to execute Form 4506-C on behalf of the taxpayer. Note: This form must be received by IRS within 120 days of the signature date.
Signatory attests that he/she has read the attestation clause and unon so reading declares that he/she has the authority to sign the
Form 4506-C. See instructions.

output of this should be false

should not include any space

@Yoichi do you have idea Sir?

@AhmedKutraphali - Please check this…

https://regex101.com/r/v0y6X8/1/

Covered all the 3 variations here. Regex returns 2 matches.

1 Like

Can there be two words before Signatory?

like below

to execute Form 4506-C on behalf of the taxpayer. Note: This form must be received by IRS within 120 days of the signature date.
**X Y** Signatory attests that he/she has read the attestation clause and unon so reading declares that he/she has the authority to sign the
Form 4506-C. See instructions
1 Like

@AhmedKutraphali - if there are multiple words …use the below one…

  (?<=signature date\.\r?\n).*(?=\sSignatory attests)
2 Likes

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