Sachith Muhandiram
Sachith Muhandiram

Reputation: 2970

How to ignore specific charactor and new line using regex

I am trying to validate a csv file using Apache-NiFi.

My CSV file has some defects.

id,name,address
1,sachith,{"Lane":"ABC.RTG.EED","No":"12"}
2,nalaka,{"Lane":"DEF",
"No":"23"}
3,muha,{"Lane":"GRF.FFF","No":"%$&%*^%"}

Here in second row,its been divided into two lines and third row has some special characters.

I want to ignore both the lines. For that I use \{("\w+":"\w+",)*[^%&*@]*\}, but this is not capturing row split error and new line.

I also used \{("\w+":"\w+",)*[^%&*@]*\}$, but it doesnt even get the right answer.

Upvotes: 0

Views: 45

Answers (1)

Eraklon
Eraklon

Reputation: 4288

This is you might looking for: ^[0-9]+,[a-z]+,\{("\w+":"[\w\.]+","\w+":"[a-zA-Z0-9]+")\}$

Upvotes: 1

Related Questions