:%s/[.@/]\@<!\(\<\w*\>\)\(@\|\.\w\|:\/\)\@!/\u\1/g

:%s/.*/\L&/g
konvertiert den Bufferinhalt nach Kleinschrift. Die bearbeitete Datei kannte diese aus historischen Gründen nicht.
:%s/[.@/]\@<!\(\<\w*\>\)\(@\|\.\w\|:\/\)\@!/\u\1/g
bringt allen Wörtern, die nicht Teil einer E-Mail-Adresse oder URL sind, Großschreibung bei (das Leerzeichen gehört übrigens nicht in die Zeile, sondern erscheint dort durch einen Bug von WordPress). Es muß ja nicht immer perl sein. :)
Bei Texten die Umlaute enthalten, sollte man übrigens das \w besser durch ein \(\w\|[äöüß]\) ersetzen.
Vim kann sehr praktisch sein.
Und wenn ich das nächste mal so etwas mache, schaue ich einfach in mein Blog. ;)
Ein Blog kann sehr praktisch sein.

4 Responses to “:%s/[.@/]\@<!\(\<\w*\>\)\(@\|\.\w\|:\/\)\@!/\u\1/g”

  1. Dave says:

    Ich weiss nicht, ob das Leerzeichen ein WordPress Bug ist. Spitze Klammern knnen HTML rendering leicht stren. Tipp: Pack die Zeichenfolge mal in eine CDATA section und schau, ob das Leerzeichen verschwindet.

  2. Blogfhrer says:

    Update 2: Das Problem mit dem Parsen ist nach dem WordPress-Upgrade offenbar behoben. Ein kleines Problemchen beim Editieren dieses Kommentars war, da sich die Backslashes auf wundersame Weise vervielfltigten, wie man unten sieht, aber, was will man machen…

    Update: mittlerweile wird auch der Backslash geparsed, ich habe das Post und diesen Kommentar entsprechen geupdated entsprechend geupdated sowie die Orignalfassung unten als Zitat eingefgt.

    Meinst Du das:

    < ![CDATA[:%s/[.@/]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\(@\\\\\\\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\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\(@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\w\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@!/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\u\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\1/g]]>

    Nun, das Leerzeichen erscheint an anderer Stelle, wie CDATA und andere Sachen, die Du selber siehst, dafr verschwinden einige wichtige Zeichen…
    Zum Vergleich noch einmal die WordPress-Interpretation des oben dargestellten Strings: aus

    :%s/[.@/]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@< !\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\<\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\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\\\\\\\\\\\\.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\w\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@!/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\u\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\1/g]]>

    Daraus wird ohne Maskierung von \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”< \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" und \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” das:

    < ![CDATA[:%s/[.@/]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\(@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\w\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@!/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\u\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\1/g]]>

    Nun, das Leerzeichen erscheint an anderer Stelle, wie CDATA und andere Sachen, die Du selber siehst, dafr verschwinden einige wichtige Zeichen…
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\\\\\\\\\\\)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\@!/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\u\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\1/g
  3. Dave says:

    Tja, sieht so aus, als ob die CDATA section nicht als solche durch den Template Mechanismus von WordPress kommt. Vielleicht gibt es ja in der neuen Version eine Lsung dafr?

  4. Blogfhrer says:

    Ja, s. o.!