views:

40

answers:

1

(only the first # is a delimiter)

50#some message from me to you #1 or #2

into

array 
(
    [amount] => 50
    [message] => 'some message from me to you #1 or #2'
)
+4  A: 

You don't need regex for such a simple split. The following will split your string correctly:

explode('#', $string, 2)

This will return an array like:

Array
(
    [0] => '50'
    [1] => 'some message from me to you #1 or #2'
)

See explode for more details.

If your query does end up getting more complex, then look at preg_split.

catchdave