Etienne Kneuss

home » news » FAQ

SPL Datastructures

The Standard PHP Library was recently completed by a couple of data structures, namely heaps and doubly linked lists. You can find more information about those on
php.net/spl.datastructures

Feeds available

You can read colder.ch directly from the rss/atom feeds:
rss general RSS (general)
rss php RSS (PHP)
atom general Atom (general)
atom php Atom (PHP)

New design : Clearblue

I've made a new skin using the same design with blue colors: Clearblue. Check it out

New website

As you can see, the website has changed completely. I've re-designed everything using different types of technology to give an overall improvement. Take a look in the news section for detailed information.

FAQ The 28th of June 2006 @ 10:27

Table of Content

  1. Introduction
  2. 1: preg_* error: Unknown modifier

Introduction

You will find here some questions/problems that are frequently seen on IRC, related more or less to PHP. I'll add things when I find the time/ideas,

FAQ 1: preg_* error: Unknown modifier

Unlike POSIX regex functions, functions using PCRE like preg_match, preg_replace and preg_split use a different format for their pattern argument. PCRE supports some modifiers that are passed within the pattern argument. Thus, you need to delimit the actual regex pattern from the modifiers. That's why delimiters are required in your pattern argument. The pattern syntax required is the following:

pattern ::= startingDelimiter regex endingDelimiter [modifiers]

There are many possible delimiters (like "/", "#", "~", "!", "@", "%" ...) you should pick one not used in your regex, or you would have to escape it.

<?php preg_match('#http://myurl/([^/]+)/my_file#', $input); preg_match('~http://myurl/([^/]+)/my_file.*$~ms', $input); // using the multiline and dotall modifier ?>

Comments

There is currently no comment here.

Add a comment

Username:

Spam Challenge: 8+10=?

Comment: