Re: Premature end of regular expression with non-ascii chara


#1

Dear Nick,

I’m glad things finally worked out for you.
Actually, I things like ‘\352’ do not to split any further (at least on
my
system (cygwin 6.7.0.0-6) on Windows XP),
this seems to be some encoding for “ê” etc. that is Windows-specific.
In particular, it is not equivalent to a string composed of ‘’,
‘3’,‘5’,‘2’
(you would have to double the ‘’ in the regexp if you were searching
for a string ‘\352’ in a text).

But the line

splitted_text=text.split(/(?=.)/)

should produce an Array with the individual letters in the string.
That involves a concept about regexps called zero-width positive
lookahead (see http://www.regular-expressions.info/lookaround.html
(http://www.regular-expressions.info/lookaround.html) ).

Please let us all know if you still encounter problems.

Best regards,

Axel


#2

On Jan 31, 2006, at 1:56 PM, removed_email_address@domain.invalid wrote:

(you would have to double the ‘’ in the regexp if you were searching

Please let us all know if you still encounter problems.

Best regards,

Axel

Zero width positive lookahead is a little overkill, split(//) works
just as well, AFAIK