On Jul 14, 2:59 pm, chas.ow...@gmail.com ("Chas. Owens") wrote:
> On Wed, Jul 14, 2010 at 00:50, C.DeRykus <dery...@gmail.com> wrote:
>
> snip>> s/(\w+)\s/$1&nbsp;/g;
> snip
> > Neat.  Using the \K construct available in 5.10, you can even
> > eliminate the need for the capture:
>
> >   s/  \w+  \K \s /&nbsp;/gx;
>
> snip
>
> Yeah, but both of these are fragile, the following string won't work:
>
> data: "this, is a string" more: "this is another"

Agreed this isn't the most robust but there wasn't a
complete spec so "simple quoted string"  might throw
someone.

And I notice the OP's original despace sub for instance
contained:  s/\s/&nbsp;/g;

But, one of the solutions morphed  that to:
                 s/ /&nbsp;/g

which, might or might not, be right either.

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to