downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Yapılandırma/Kurulum> <Perl Uyumlu Düzenli İfadeler
Last updated: Fri, 27 Nov 2009

view this page in

Giriş

Bu işlevlerde kullanılan şablonların sözdizimi Perl düzenli ifade şablonlarınınkine çok benzer. Örneğin, ifadenin bir ayraçla (bir bölü çizgisi) sarmalanması gerekir. Tersbölü çizgisi ve 0. karakter haricinde her karakter ayraç olarak kullanılabilir. Eğer ayraç karakteri, ifadenin içinde kullanılmışsa bir tersbölü çizgisi ile öncelenmesi gerekir. PHP 4.0.4'ten beri, Perl tarzı (), {}, [] ve <> ayraç çiftleri kullanılabilmektedir. Daha ayrıntılı bilgi için Şablon Sözdizimi bölümüne bakınız.

Sonlandırıcı ayracın ardına eşleşmeyi etkileyen çeşitli değiştiriciler eklenebilir. Daha ayrıntılı bilgi için Şablon Değiştiricileri bölümüne bakınız.

PHP ayrıca, POSIX gelişkin sözdizimini kullanan gelişkin POSIX düzenli ifade işlevlerini de destekler.

Bilginize: Bu eklenti her evre için ayrı bir derlenmiş düzenli ifade önbelleği (en fazla 4096 bayt) tutar.

Uyarı

PCRE ile ilgili bir takım kısıtlamalar hakkında bilgi sahibi olmalısınız. Daha ayrıntılı bilgi için » http://www.pcre.org/pcre.txt adresine bakınız.

PCRE kütüphanesi, düzenli ifade şablonlarını bir kaç küçük fark dışında, Perl 5 ile aynı sözdizimini ve aynı anlamsallığı kullanarak gerçekler. Şu anki gerçeklenim Perl 5.005 sürümüne karşılık gelir.



add a note add a note User Contributed Notes
Giriş
m dot colombo at NOSPAM dot esi dot it
12-Oct-2009 10:22
Converting POSIX regex patters to PCRE is non-trivial. I had many (about 17.000) patterns stored in a DB, and found that surrounding one with delimiters (such as '/'), after quoting them, is not enough.

I've been biten by a \r that slipped into a pattern (that was supposed to be \.r and became .\r instead). Too bad in PCRE it stands for carriage-return.

AFAIK, there's no way to disable this behaviour and make PCRE more POSIX compatibile. You have to look for every single escape sequence that has no meaning in POSIX regex but has one in PCRE and remove the backslash.

Before POSIX regex are removed it would be really cool to have a function that converts a POSIX regex pattern into the equivalent PCRE one.
Anonymous
12-Aug-2009 12:51
php supports posix regular expressions, but only in the short term.

pcre seems capable of most things posix regex does

One point of difference is that PCRE requires you delimit your regex, that is: start and end it with a character that is not used elsewhere in the regex,
this provides a space after the ending delimiter to put option characters.

Yapılandırma/Kurulum> <Perl Uyumlu Düzenli İfadeler
Last updated: Fri, 27 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites