user3631498
user3631498

Reputation:

Regex : two conditions

I have a csv file with many lines.

I want to get lines with a ;F; or a ;A; but not with ;REPORTING;.

  1. 123456;;;;;75;;;;A;18;-83;-7;19;;
  2. 654321;52;;;;;;;;F;8;-3;7;489;;
  3. 123456;;;;;;573;;;;1858;-88963;-746;1549;;
  4. 123456;;523;;;REPORTING;fd3574;;;A;183001;-86583;-457;19211;;

I want to get line 1 and 2 but not line 3 and 4...

I tried :

;(?!REPORTING);.*;(F|A);

but no success...

Any idea ?

Upvotes: 1

Views: 109

Answers (1)

rock321987
rock321987

Reputation: 11032

This will work

^(?=.*;[AF];)(?!.*;REPORTING;)

Regex Demo

Upvotes: 1

Related Questions