Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg_match - pytanie
Pietyk
post
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
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
Post #3





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

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


nie dziala (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) ma ktos inne pomysle?
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 3.10.2025 - 18:58