Autor Beitrag
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: So 14.12.08 16:20 
Hallo,

ich habe momentan das Problem, dass bei mir die Backreferenzen in PHP nicht laufen.

Regulärer Ausdruck:
ausblenden Quelltext
1:
(\w+)((?:\s*\w+\s*=\s*(?:(["']?)\w+\3))*)					

Testcode, auf dem der reguläre Ausdruck funktionieren müsste:
ausblenden Quelltext
1:
test name = bla df = "asd" ds = "sd"					


Wenn ich das \3 weglasse, findet er immerhin einen Teil. Sprich irgendwo hat er ein Problem mit dem \3. Hat einer eine Idee, wieso das unter php nicht läuft (RegexBuddy aber das richtig matcht)?

Grüße
Heiko
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: So 14.12.08 19:18 
Hier funktionierts :nixweiss: .

_________________
>λ=
Heiko Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: So 14.12.08 19:47 
Mhm, da leider schon, aber mein php nicht :(.

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<?php

/**
 *
 *
 * @version $Id$
 * @copyright 2008
 */


echo  "<pre>";
preg_match("/(\w+)((?:\s*\w+\s*=\s*(?:([\"']?)\w+\3))*)/""{{test name = bla df = \"asd\" ds = \"sd\"}} ", $matches);

print_r($matches);
echo  "<pre>";
?>


ergibt:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
Array
(
    [0] => test
    [1] => test
    [2] => 
)


statt wie erwartet (und von supercrumbly angezeigt)
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
Array
(
    [0] => test name = bla df = "asd" ds = "sd"
    [1] => test
    [2] =>  name = bla df = "asd" ds = "sd"
)


Wie sieht es bei dir aus, wenn du es lokal ausführst?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: So 14.12.08 20:34 
user profile iconHeiko hat folgendes geschrieben Zum zitierten Posting springen:
Wie sieht es bei dir aus, wenn du es lokal ausführst?
Mein Tester (.Net) akzeptiert es auch.

_________________
>λ=
Heiko Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Mo 15.12.08 11:26 
Mhm - ich habs gerade auf nem anderem PHP-Server getestet und auch da funktioniert es nicht :(.
Jungschar
Hält's aus hier
Beiträge: 1



BeitragVerfasst: So 21.12.08 16:47 
hiho

Frag mal im Forum von modrewrite.de.
Die kennen, Lösungen für so ziemlich jedes Problem mit regulären Ausdrücken. ;)

Gruess Jungschar