Autor | Zpráva | ||
---|---|---|---|
alfa47 Profil * |
#1 · Zasláno: 7. 10. 2013, 15:21:13
Ahojte,
mam takyto regularny vyraz: preg_match('/.*([0-9]{3} ?[0-9]{2}) +([\p{L} ]+)[0-9]?.*/', '040 01 Trenčianske teplice 1', $matches); a chcem ziskat PSC a mesto bez cisla. Vsetko by fungovalo, ak by tam nebola diakritika. S nou sa to zasekne na tom makkceni. Som prezradny, pretoze \p{L} by to malo prave riesit. Tusite prosim kde moze byt chyba? Vopred dakujem velmi pekne. |
||
juriad Profil |
#2 · Zasláno: 7. 10. 2013, 15:24:32
echo preg_match('/.*([0-9]{3} ?[0-9]{2}) +([\p{L} ]+)[0-9]?.*/', '040 01 Trenčianske teplice 1', $matches); var_dump($matches); echo preg_match('/.*([0-9]{3} ?[0-9]{2}) +([\p{L} ]+)[0-9]?.*/u', '040 01 Trenčianske teplice 1', $matches); var_dump($matches); |
||
alfa47 Profil * |
#3 · Zasláno: 7. 10. 2013, 15:28:25
juriad:
Velka vdaka, takze ten modifikator znamena, ze to bere ako UTF-8 ano? |
||
peta Profil |
#4 · Zasláno: 8. 10. 2013, 11:05:32
http://cz1.php.net/manual/en/reference.pcre.pattern.modifiers.php
u (PCRE_UTF8) This modifier turns on additional functionality of PCRE that is incompatible with Perl. Pattern strings are treated as UTF-8. This modifier is available from PHP 4.1.0 or greater on Unix and from PHP 4.2.3 on win32. UTF-8 validity of the pattern is checked since PHP 4.3.5. |
||
Časová prodleva: 11 let
|
0