<?php
$regex = '~(?s)\[code\].*?\[/code\](*SKIP)(*F)|\n~';

$subject = "These concepts are represented by simple Python classes.  
Edit the polls/models.py file so it looks like this: 

[code]  
from django.db import models

class Question(models.Model):
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published') 
[/code]";

$replaced = preg_replace($regex,"<br />",$subject);
echo $replaced."<br />\n";
?>