fork download
  1. <?php
  2. $regex = '~(?s)\[code\].*?\[/code\](*SKIP)(*F)|\n~';
  3.  
  4. $subject = "These concepts are represented by simple Python classes.
  5. Edit the polls/models.py file so it looks like this:
  6.  
  7. [code]
  8. from django.db import models
  9.  
  10. class Question(models.Model):
  11. question_text = models.CharField(max_length=200)
  12. pub_date = models.DateTimeField('date published')
  13. [/code]";
  14.  
  15. $replaced = preg_replace($regex,"<br />",$subject);
  16. echo $replaced."<br />\n";
  17. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
These concepts are represented by simple Python classes.  <br />Edit the polls/models.py file so it looks like this: <br /><br />[code]  
from django.db import models

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