Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg_match - pytanie
Pietyk
post 19.01.2008, 17:57:50
Post #1





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 24.01.2006

Ostrzeżenie: (0%)
-----


preg_match('/^find(\w+?)Via(\w+?)(?:By(\w+?)(?:And(\w+))?)?$/', $method, $matches)

to pasuje do:

find<Class1>Via<Class2>()
find<Class1>Via<Class2>By<Rule>()
find<Class1>Via<Class2>By<Rule1>And<Rule2>()

a jak dopasować do wielu AND, np:

find<Class1>Via<Class2>By<Rule1>And<Rule2>And<RuleN>()
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Cotter
post 19.01.2008, 18:07:34
Post #2





Grupa: Zarejestrowani
Postów: 57
Pomógł: 12
Dołączył: 6.01.2008
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Ten kawałeczek (?:And(\w+))? zamienić na: (?:And(\w+))*

* - 0 lub więcej
? - 0 lub 1
+ - jeden lub więcej
Go to the top of the page
+Quote Post
Pietyk
post 21.01.2008, 18:55:42
Post #3





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 24.01.2006

Ostrzeżenie: (0%)
-----


nie dziala sad.gif ma ktos inne pomysle?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 12:00