I'm usually pretty good with regex but this one has me stumped. I've read the other SO posts about negative looks but nothing seemed to work. I'm looking for a pure regex solution (not piped through anything like grep) because this has to be a single operation (in Atom IDE search).
Here's the issue:
Looking for all instances of the word "core" that are NOT preceded by "vpc_" and specifically capturing "core", not lines that contain core, because this is for Find/Replace, so I don't want to "select" the whole line, just the word core.
EDIT:
resource "aws_internet_gateway" "igw_core" {
vpc_id = "${aws_vpc.vpc_core.id}"
tags {
Environment = "${var.environment}"
Name = "${var.environment}_igw_core"
Version = "${var.version}"
}
}
I want to replace "core" with "foo" except "vpc_core" which should remain. The result should be:
resource "aws_internet_gateway" "igw_foo" {
vpc_id = "${aws_vpc.vpc_core.id}"
tags {
Environment = "${var.environment}"
Name = "${var.environment}_igw_foo"
Version = "${var.version}"
}
}