Thread Vokale im Umlaute wandeln (20 answers)
Opened by Tom950 at 2014-03-18 06:48

FIFO
 2014-03-19 00:43
#174282 #174282
User since
2005-06-01
469 Artikel
BenutzerIn

user image
2014-03-18T20:58:04 Tom950
Suchen: -> Ersetzen:
ae([^u]) -> ä$1
A[eE]([^uU]) -> Ä$1
([^ae])ue -> $1ü
([^ae])U[eE] -> $1Ü


Nur so bzgl. Perl lernen: Für das, was Du da machst gibt es sog. lookarounds, dann braucht keine Gruppe eingefangen und $1 nicht verwendet werden:

Code (perl): (dl )
1
2
3
4
$text =~ s/ae(?!u)/ä/g;         # negativer lookahead
$text =~ s/A[eE](?![uU])/Ä/g;
$text =~ s/(?<![ae])ue/ü/g;     # negativer lookbehind
$text =~ s/(?<![ae])U[eE]/Ü/g;


usw, eine ausführliche Anleitung gibt's z.B. hier.
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"

View full thread Vokale im Umlaute wandeln