Hello

I have an $output varaiable containing this

<email@abramsandsmith.com> to: adugarte@my.com (windows-1250)
<email@aberfeldy.freeserve.co.uk> to: macosta@my.com (31 Jan 2007 16:14)
<email@bluewavecomputing.com> to: adugarte@my.com (31 Jan 2007 0060)
<email@aahanet.org> to: jguillen@my.com (31 Jan 2007 16:15:47 -0540)

I am trying to replace all spaces between () with an underscore _
How to do that I am going mad trying and trying.

I am trying to obtain this
echo $output should return this

<email@abramsandsmith.com> to: adugarte@my.com (windows-1250)
<email@aberfeldy.freeserve.co.uk> to: macosta@my.com (31_Jan 2007_16:14)
<email@bluewavecomputing.com> to: adugarte@my.com (31_Jan_2007_0060)
<email@aahanet.org> to: jguillen@my.com (31_Jan 2007_16:15:47
-0540)

Any help ? Thanks

    $output = preg_replace('/\(([^)]+)\)/e', "'('.str_replace(' ', '_', '\\1').')'", $output);
    

      Thank you , it works perfectly !

        Write a Reply...