Wow, it's been a long time since I've had to ask for that, but this has me
stumped. It's probably going to be something simple I'm overlooking, in
which case I shall properly beat myself in the forehead with a board while
chanting sonorously, but meanwhile...
I have a string broken into sections using the vertical pipe as a
delimiter. I want to insert an underscore between any which have nothing or
only spaces between them. However, if I have consecutive occurrences of
this pattern, it only finds 1 and 2, but not 2 and 3. To illustrate:
$x = '|||||';
$x = preg_replace('= \| *\|=U', '|_|', $x);
Result:
|_||_||
What I need is:
|_|_|_|_|
Any suggestions?
--
Alan Little
Phorm PHP Form Processor
stumped. It's probably going to be something simple I'm overlooking, in
which case I shall properly beat myself in the forehead with a board while
chanting sonorously, but meanwhile...
I have a string broken into sections using the vertical pipe as a
delimiter. I want to insert an underscore between any which have nothing or
only spaces between them. However, if I have consecutive occurrences of
this pattern, it only finds 1 and 2, but not 2 and 3. To illustrate:
$x = '|||||';
$x = preg_replace('= \| *\|=U', '|_|', $x);
Result:
|_||_||
What I need is:
|_|_|_|_|
Any suggestions?
--
Alan Little
Phorm PHP Form Processor
Comment