[Techtalk] RegEx problem in vim

Gebhard Dettmar gebhard.dettmar at student.hu-berlin.de
Mon Jul 26 20:17:24 EST 2004


Hi everyone,
I have a phd-thesis to format according to a Mouton de Gruyter
template (.dot ;-(
In the bibliography everything is like
---snip---
Eiselen, W M [1934]
	1967	Christianity and the religious life of the Bantu. In
Schapera, I (ed), Western civilization and the 
natives of South Africa. London: Routledge and Kegan Paul.
---snap---
Of course the first name-initials must be abbreviated with a dot
So I saved the bibliography as a text + line breaks file, deleted DOS
carriage returns (learned from my last problem ;-)
and wrote in vim:
:%s/\([A-Z]\) /\1. /g
which means, (or at least is intended to ;-): any capital letter
followed by a space is to be substituted by this letter + dot + space
He matches 351 Characters
Now the Capitals letters followed by a newline are left.
when I write :%s/\([A-Z]\)\n/\1.\n
he matches 250 characters but deletes the newline, which I want to
keep. So he recognizes the newline in the search-part but ignores in
the substitute-part. What am I doing wrong here?
Any help would be appreciated
Thanks in advance
Gebhard





More information about the Techtalk mailing list