Geniş Ekran Modu Otomatik Ekran Boyutu Font Boyutunu Azalt Font Boyutunu Azalt Font Boyutunu Normal Yap Yazdır

Php Regular Expression

İngilizce bir makaledir.

Php Regular ExpressionSpecial Sequences

  • w - Any “word” character (a-z 0-9 _)
  • W - Any non “word” character
  • s - Whitespace (space, tab CRLF)
  • S - Any non whitepsace character
  • d - Digits (0-9)
  • D - Any non digit character
  • . - (Period) – Any character except newline

Meta Characters

  • ^ - Start of subject (or line in multiline mode)
  • $ - End of subject (or line in multiline mode)
  • [ - Start character class definition
  • ] - End character class definition
  • | - Alternates, eg (a|b) matches a or b
  • ( - Start subpattern
  • ) - End subpattern
  • - Escape character

Quantifiers

  • n* - Zero or more of n
  • n+ - One or more of n
  • n ? - Zero or one occurrences of n
  • {n} - n occurrences exactly
  • {n,} - At least n occurrences
  • {,m} - At most m occurrences
  • {n,m} - Between n and m occurrences (inclusive)

Pattern Modifiers

  • i - Case Insensitive
  • m - Multiline mode - ^ and $ match start and end of lines
  • s - Dotall - . class includes newline
  • x - Extended– comments and whitespace
  • e - preg_replace only – enables evaluation of replacement as PHP code
  • S - Extra analysis of pattern
  • U - Pattern is ungreedy
  • u - Pattern is treated as UTF-8

Point based assertions

  • b - Word boundary
  • B - Not a word boundary
  • A - Start of subject
  • Z - End of subject or newline at end
  • z - End of subject
  • G - First matching position in subject

Assertions

  • (?=) - Positive look ahead assertion foo(?=bar) matches foo when followed by bar
  • (?!) - Negative look ahead assertion foo(?!bar) matches foo when not followed by bar
  • (?<=) - Positive look behind assertion (?<=foo)bar matches bar when preceded by foo
  • (? - Negative look behind assertion (?
  • (?>) - Once-only subpatterns (?>d+)bar Performance enhancing when bar not present
  • (?(x)) - Conditional subpatterns
  • (?(3)foo|fu)bar - Matches foo if 3rd subpattern has matched, fu if not
  • (?#) - Comment (?# Pattern does x y or z)

Pattern Modifiers

i (PCRE_CASELESS)

If this modifier is set, letters in the pattern match both upper and lower case letters.

m (PCRE_MULTILINE)

By default, PCRE treats the subject string as consisting of a single "line" of characters (even if it actually contains several newlines). The "start of line" metacharacter (^) matches only at the start of the string, while the "end of line" metacharacter ($) matches only at the end of the string, or before a terminating newline (unless D modifier is set). This is the same as Perl.

When this modifier is set, the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the subject string, respectively, as well as at the very start and end. This is equivalent to Perl's /m modifier. If there are no "n" characters in a subject string, or no occurrences of ^ or $ in a pattern, setting this modifier has no effect.

s (PCRE_DOTALL)

If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.

x (PCRE_EXTENDED)

If this modifier is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class, and characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored. This is equivalent to Perl's /x modifier, and makes it possible to include comments inside complicated patterns. Note, however, that this applies only to data characters. Whitespace characters may never appear within special character sequences in a pattern, for example within the sequence (?( which introduces a conditional subpattern.

e

If this modifier is set, preg_replace() does normal substitution of backreferences in the replacement string, evaluates it as PHP code, and uses the result for replacing the search string. Single and double quotes are escaped by backslashes in substituted backreferences.

Only preg_replace() uses this modifier; it is ignored by other PCRE functions.

Note: This modifier was not available in PHP 3.

A (PCRE_ANCHORED)

If this modifier is set, the pattern is forced to be "anchored", that is, it is constrained to match only at the start of the string which is being searched (the "subject string"). This effect can also be achieved by appropriate constructs in the pattern itself, which is the only way to do it in Perl.

D (PCRE_DOLLAR_ENDONLY)

If this modifier is set, a dollar metacharacter in the pattern matches only at the end of the subject string. Without this modifier, a dollar also matches immediately before the final character if it is a newline (but not before any other newlines). This modifier is ignored if m modifier is set. There is no equivalent to this modifier in Perl.

S

When a pattern is going to be used several times, it is worth spending more time analyzing it in order to speed up the time taken for matching. If this modifier is set, then this extra analysis is performed. At present, studying a pattern is useful only for non-anchored patterns that do not have a single fixed starting character.

U (PCRE_UNGREEDY)

This modifier inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It is not compatible with Perl. It can also be set by a (?U) modifier setting within the pattern or by a question mark behind a quantifier (e.g. .*?).

X (PCRE_EXTRA)

This modifier turns on additional functionality of PCRE that is incompatible with Perl. Any backslash in a pattern that is followed by a letter that has no special meaning causes an error, thus reserving these combinations for future expansion. By default, as in Perl, a backslash followed by a letter with no special meaning is treated as a literal. There are at present no other features controlled by this modifier.

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.


Kaynak www.phpbuilder.com/manual/en/reference.pcre.pattern.modifiers.php
Bu içerikle ilgili henüz herhangi bir yorum yapılmamıştır. Bu içerikle ilgili Yorumunuzu eklemek için burayı tıklayınız.

Php Dersleri

Xampp Kurulumu
Php,apache,mysql hepsini tek dosyayla kurulumu
Xampp Kurulumu
Xampp apache, mysql, php ve phpmyadmin için kolay ve basit kurulum sağlayan bir uygulamadır.
PHP kurulumu
Windows 7 Üzerine Apache, Mysql, Php ve NetBeans Kurulumu (WAMP)
PHP nedir?
HTML kodlarının arasına yerleştirilmiş php kodlarından ayrıştırıp işleyerek sonuçta saf HTML formatı...
Verileri doğrulamak için PHP ile filtreleme işleml...
Ziyaretçilerden gelen verilerin istediğimiz formata uygunluğunu kontrol etmeliyiz ki, güvenlik açığı...
Php Mysql to XML
Bu yapıyı geliştirerek mysql veritabanınızdaki datalarınızı xml standartlarına dönüştürebilirsiniz.
Utf8 İle Iso-8859-9 Dönüştürmek
Bu işlemde php nin mb_convert_encoding fonksiyonunu kullanıyoruz.
Php5 İle Xml Dosya Oluşturmak
İngilizce bir makaledir.
Php4 İle Xml Dosya Oluşturmak
İngilizce bir makaledir.
Php İle Excel Dosyası Oluşturmak
Genelde, herhangi bir biçimlendirme söz konusu olmadığında, veritabanındaki bir bilgiyi ya da başka ...
Curl(client Url Library Functions) Nedir?
Curl ile kullanıcı kontrolü nasıl yapılır?
Harici Dosya İnclude
İnclude kullanımı ve örnekler
Class İçerisinden Class Tanımlamak
İç içe klaslar oluşturmak
Mysql_fetch_object, Mysql_fetch_array, Mysql_fetch...
Mysql_fetch_object, mysql_fetch_array, mysql_fetch_row, mysql_fetch_assoc, mysql_result kullanımı...
Php İle Mysql Veritabanından Bilgi Çekme
Mysql_fetch_assoc, mysql_fetch_row, mysql_fetch_object, mysql_fetch_array ve mysql_result metodları
Mysql İle Veritabanı Bağlantı Fonksiyonları
Mysql_result, mysql_fetch_array, mysql_fetch_row, mysql_fetch_object
Phpde Exception İstisna Yönetimi
Phpde istisna kontrol ve yönetimi
Excepiton
Exception türkçe anlamı istisna olan kelimedir. İstisnalar php'de hata yönetimini kolay, genişletile...
Karar Kontrol Mekanizması
Php 5 ile gelen yeniliklerin başında hata kontrol mekanizmasında yapılan yenilik gelmektedir. Php 4'...
En iyi 25 php template motoru
Php tabanlı web siteleri dizayn ederken, php kodlarını html kodlar arasına gömeriz. Fakat gün gel...
WinBinder İncelenmesi
WinBinder indirmek ve yüklemek , WinBinder Yapısı Hakkında Bilgiler , WinBinder Örnekleri , WinBinde...
Oop - Nesne Yönelimli Programlama
Artık ister istemez her programcının bulaştığı bu teknik hakkında sayısız makale yazılmıştır bu güne...
Nesneye Yönelimli Php
Classlarla ilgili ingilizce bir makale
Basit Class Yapılarında Kullanılan Kelimeler
New, ::, __construct, __autoload kullanımları
Classlarda Kullanılan Özel Kelimeler
Public, private, protected, extends, _construct
$_sessıon
$_sessıon[] değişkeni o anki oturumla ilgili olan değişkenleri tutmakta görevli olan varsayılan olar...
$_FILES
Örnek kod ve açıklamalar
  • 1
  • 2

Ödev Gönder | İncelenmeyi Bekleyen Ödevler | Uygulama Resimleri | Uygulama Resmi Gönder | İnternet Üzerinden Sınav | Test Sorusu Gönder | Sınıf Karneleri | Anketler | Linkler
www.dijitalders.com

bilgidijitalders.com
Bu sayfalar en iyi 1024 x 768 ekran çözünürlüğünde görüntülenir.
Site içerikleri, site kullanıcıları tarafından yollanan içeriklerdir. Her hangi bir içeriğin lisanslı yahut şahsınıza ait olduğunu tarafımıza iletirseniz gerekli düzenlemeyi yapacağız. Kullanılan içerikler, siteyi kullanan öğrenciler ve araştırmacılar için kolaylık sağlamak amacıyla oluşturulmuştur.
Sayfada HATA! Olduğunu Düşünüyorsanız | Sık Kullanılanlara Ekle | www.dijitalders.com'u Ana Sayfam Yap | Web Tasarımcıya e-Posta
Bu site 150,591 kişi tarafından ziyaret edilmiştir.