[ create a new paste ] login | about

Link: http://codepad.org/WCplAC2r    [ raw code | output | fork ]

PHP, pasted on Mar 31:
1
2
3
4
5
6
7
8
9
<?php

$str = "var a = 'a',
    b = 'bob';";


$str = preg_replace('/(?<!;)\s*\n/', ";\n", $str);

var_dump($str);


Output:
1
2
string(28) "var a = 'a',;
    b = 'bob';"


Create a new paste based on this one


Comments: