Ich möchte in einem Text-File (wird zur Ausgabe an den Browser geschickt) alle Textstellen
/lib/ durch http://url.com/lib/
ersetzen, wenn nicht schon http://url.com/lib/ vorhanden ist bzw. url.com vor lib vorkommt
(es kann vorkommen dass andere Programmteile bereits diesen String liefern)
modedit Editiert von GwenDragon: Code-Fragmente in inline-Code gestellt wg. automatischer URL Last edited: 2012-12-06 08:49:44 +0100 (CET)
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"
+2 replies
Muffi
2012-12-06 08:26
User since 2012-07-18
1465
Artikel BenutzerIn
Ich könnt mir vorstellen, dass url.com nur ein Platzhalter war. Und mit variabler Länge glaub ich funktioniert der lookbehind dann nicht mehr.
1 + 1 = 10
FIFO
2012-12-06 08:48
User since 2005-06-01
469
Artikel BenutzerIn
mit variabler Länge geht das beim lookbehind nicht. Aber warten wir mal den OP ab ...
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"
pq
2012-12-06 09:56
User since 2003-08-04
12209
Artikel Admin1
alternativ hilft vielleicht URI::Find.
da kannst du einen callback angeben, der für den rest des textes ausgeführt wird, also für alles ausser urls.