You are viewing limited content. For full access, please sign in.

Question

Question

Regex Help

asked on October 9, 2018

Hi Everyone

 

I have the Following text and require the string between two anchors

 

Anchor 1 {027CAPE1822011128514} is provided by workflow as the token to start Regex string.

Anchor 2 {Subtotal} this is static anchor

  027CAPE1822011010916
Service ID:
A-End Address: B-End Address:
xxx Cape Town Western Cape South
Africa
Product Description Units From Date To Date Currency Qty/Usage Subtotal VAT Amount
NeoOne Last Mile Access 01/10/2018 31/10/2018 ZAR 1.00 2,500.00 375.00 2,875.00
2,500.00 375.00 2,875.00
Subtotal
 027CAPE1822011128514
Service ID:
A-End Address: B-End Address:
xxx Cape Town Western Cape Africa
Product Description Units From Date To Date Currency Qty/Usage Subtotal VAT Amount
NeoOne Last Mile Access 01/10/2018 31/10/2018 ZAR 1.00 2,500.00 375.00 2,875.00
2,500.00 375.00 2,875.00
Subtotal

I would like to extract the text between the anchors, the text length is variable. I am not able to anchor the string to the Subtotal found at the start of the new line.

 

My current Regex. (%Service ID Token)([^_]+.\r\nSubtotal\s?[^_]+.)

 

Thanks in advance

 

Regards

 

0 0

Replies

replied on October 9, 2018

Hi Christo,

Does this give you what you are looking for?
(?s)%(Service ID Token)\r\n(.+?)\nSubtotal

~ Andrew

1 0
replied on October 11, 2018

Andrew Pappas Thanks for the help, works 100%

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.