I want to exclude a word say "Dogma" in my regular expression inside an awk script such that all other lines except the one containing "Dogma" is captured in the regex. How can I do that ?
input
<animal>Because I am a seeker of truth, I do not accept every bit of dogma as fact</animal><animal>The dog kept barking all night</animal><animal>The mills of God grind slowly</animal>
my regex
reg = "<" animal ">" [(^Dogma)+]</" animal ">"
desired output
<animal>Because I am a seeker of truth, I do not accept every bit of dogma as fact</animal><animal>The d## kept barking all night</animal><animal>The mills of G## grind slowly</animal>
I am matching the line with the regex and if the line matches the regex defined above, it will substitute the desired word by extracting it and replacing with #. The logic is working fine for the other scenarios but not this one. As this regular expression is ignoring even the lines which has "Dogs" or "Gods" in it. How can I make regex ignore the word as a whole ? Any suggestion would be appreciated.