Reputation: 141
Given this string:
abc quantity
abc quantity
abc quantity
abc quantity
abc quantity id
abc quantity
abc quantity
I am looking to keep only the unique lines, as in:
abc quantity
abc quantity id
So far, I have (?s)^(.*)(\r?\n\1)+$
and replacing with $1
as in this demo
This is not quiet producing the desired results
Any help is appreciated
Upvotes: 0
Views: 155
Reputation: 984
My advice is just split the string at \n
(new line) and push it to set.
Upvotes: 1