On Tue, Nov 29, 2011 at 9:37 AM, Michael Kuhlmann <k...@solarier.de> wrote:
> Jay,
> I think the problem is this:
>
> You're checking whether the character preceding the array of at least one
> whitespace is not a hyphen.
>
> However, when you've more than one whitespace, like this:
> "foo- \n bar"
> then there's another array of whitespaces - "\n " - which is precedes by the
> first whitespace - " ".
>
> Therefore, you'll need to not only check for preceding hyphens, but also for
> preceding whitespaces.
>
> I'll leave this as an exercise for you. ;)
>
> -Kuli

Just for the sake of closure, you were correct. I needed to update the
regex to include a whitespace character in the negative look-behind,
i.e., "(?<![-\s])\s+".

Thanks,
--jay

Reply via email to