How to split multiple row t single row using Regex

how to get one by one row data using Regex
1 WOMEN DENIM PANT OF COTTON 6203 649 589 PCS 382,261 - 382,261
2 WOMEN KNITTED SUIT OF MMF 6204 750 478 PCS 358,500 - 358,500
3 WOMEN WOVEN LONG DRESS OF COTTON 6204 915 669 PCS 612,135 - 612,135
4 WOMENS SHARARA SUIT OF COTTON 6204 825 992 PCS 818,400 - 818,400
5 GIRLS SUIT OF MMF 6204 800 432 PCS 345,600 - 345,600
6 BOYS WOVEN SHIRT/DHOTI OF MMF 6109 1020 457 PCS 466,140 - 466,140
7 WOMENS SUIT OF COTTON 6204 1330 599 PCS 796,670 - 796,670

1 Like

Hello @Bharat_Brt

Good Day!

Try this
arrayVar = StrVar.Where(Function(x) Not String.IsNullOrWhiteSpace(x)).ToArray

Cheers

1 Like

want to extract data from PDF using regex as well as all Row data but one by one using one Regex Expression

i am trying assign activity
variable= System.Text.RegularExpressions.Regex.Match(pdf_text.ToString,"(?<=\d\s)[A-Z\s/]+(?= \d)").Value.Trim

want row one by one but getting all row together

@Bharat_Brt May I know why are you using this pattern ?

If you want to use one by one, it means you would need to have a Collection of Data, In that case you might need to use Matches instead of Match.

If you want to Split the Collection of different rows that are separated by new lines and take each row one by one, you can use a String Split instead of Regex or you follow the below steps for implementing in regex.

Use this :
matches = System.Text.RegularExpressions.Regex.Matches(pdf_text.ToString,"\d+.*")

Where matches is a variable of the type MatchCollection

Then you can use a For Each Loop to loop through each row one by one by assigning the Type Argument of For Each as Match Type.

Also Check this Post, maybe you’ll find the answer you’re looking for in it.

Here is my full data
Tax Invoice/ Bill of Supply/Cash Memo
E-way Bill Number:
E-way bill Generation Date:
Sr.
No. Product Name/Product Description HSN Qty Rate UOM Value Disc Taxable Value
Total
1 WOMEN DENIM PANT OF COTTON 6203 649 589 PCS 382,261 - 382,261
2 WOMEN KNITTED SUIT OF MMF 6204 750 478 PCS 358,500 - 358,500
3 WOMEN WOVEN LONG DRESS OF COTTON 6204 915 669 PCS 612,135 - 612,135
4 WOMENS SHARARA SUIT OF COTTON 6204 825 992 PCS 818,400 - 818,400
5 GIRLS SUIT OF MMF 6204 800 432 PCS 345,600 - 345,600
6
BOYS WOVEN SHIRT/DHOTI OF MMF 6109 1020 457 PCS 466,140 - 466,140
7 WOMENS SUIT OF COTTON 6204 1330 599 PCS 796,670 - 796,670
6289 3,779,706 - 3,779,706
Freight/Ins./Other
charges
Total Taxable Value 3,779,706
CGST: 2.5% 94,492.65
SGST: 2.5% 94,492.65
IGST: 0.0% -
Final Value 3,968,691.30
Please Make Payment to:
Zilingo Technology Private Limited
Account No: 0714632051
IFSC Code: CITI0100000

Total Amount (in Words):- THIRTY NINE LACS SIXTY EIGHT THOUSAND SIX HUNDRED NINETY ONE AND THIRTY PAISE ONLY.

17-03-20 Transporter’s Vehicle Number: MH 43 F 9
Invoice date:- 05-03-20 Shipping Address:-
UNIT NO. 1
****.
xxx
PANNA,JOGESHWARI
(WEST) MUMBAI-400102 Category:- B2B/Regular
Consignee GST Registration No.:- 27ALH
38A1Z1
2311 9167 3654 Supplier Ref No.:
Invoice No.: 500 Consignee Name: THE STYLE & DESIGN CO.
Sold By: JA**** GARMENTS Buyer Name: THE STYLE & DESIGN CO.
Address:



DINDOSHI MALAD - 400097
Address:
UNIT NO. **1


PANNA,JOGESHWARI
(WEST) MUMBAI-400102
GST Registration NO.:- 27ACVA1ZV GST Registration No.: 27ALH*8A1Z1

i want product name one by one using regex

@Bharat_Brt Check if this is what you needed:
RegexTest.zip (2.9 KB)

1 Like

thank you so much!

1 Like

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