Reputation: 674
Let's say I have these lines in a file:
This and an child
That and a entrepreneur
These and a banana
This and an cookie
And I want to replace all an
and a
that are incorrect.
I can use an [^aeiou]
or a ^[aeiou]
to find all the incorrects (I think, I'm not good with regexp).
What I want is to replace the incorrects using these expressions without changing the letter after the a
/an
.
How can I do that?
Upvotes: 1
Views: 538
Reputation: 20486
You need to use a capturing group, (...)
, and then include that in the replacement
Search:
an ([^aeiou])
a ([aeiou])
Replace:
a $1
an $1
Upvotes: 4