Einzelnen Beitrag anzeigen

Benutzerbild von jim_raynor
jim_raynor

Registriert seit: 17. Okt 2004
Ort: Berlin
1.251 Beiträge
 
Delphi 5 Standard
 
#2

Re: php und reguläre Ausdrücke

  Alt 6. Dez 2005, 06:18
Zitat von yankee:
Dabei ist es mit völlig schleierhaft, warum die in php immer ein slash (/) an den anfang und ende setzen...
Weil dies der Standard bei Regulären Ausdrücken ist. Du kannst auch statt / ein ! oder "a" oder was auch immer nehmen. Nach dem Schliessenden Zeichen kannst du dann noch paar Einstellungen machen, wie zum Beispiel:
Zitat von PHP-Handbuch:
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.
und noch ein paar Mehr. Musst mal im PHP-Handbuch unter Reguläre Ausdrücke suchen.
Christian Reich
Schaut euch mein X-COM Remake X-Force: Fight For Destiny ( http://www.xforce-online.de ) an.
  Mit Zitat antworten Zitat