I have a file which has multiple rows like below:
"47058";"post";keyword1;"Why is x bad?";"https://example.com/why-is-x-bad/"
"47059";"post";keyword2;"Why is y bad?";"https://example.com/why-is-y-bad/"
I want a regex that only matches keyword1 and keyword2, basically any string inside ;;
but excluding ;"";
Goal: Add ""
around keyword1 and keyword2
CodePudding user response:
Basically, you want all matches where the keyword is just a set of letters surrounded by semi-colons (;) not surrounded by inverted commas(") followed by semi-colons.
Assuming the keyword only contains letters and nothing else.
You can use regex of ;[a-zA-Z] ;