Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Premature end of regular expression with non-ascii chara
Nuralanur
1/31/2006 6:56:00 PM
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/lookar...
(
http://www.regular-expressions.info/looka...
) ).
Please let us all know if you still encounter problems.
Best regards,
Axel
1 Answer
Logan Capaldo
1/31/2006 8:06:00 PM
0
On Jan 31, 2006, at 1:56 PM, Nuralanur@aol.com wrote:
> 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/lookar...
> (
http://www.regular-expressions.info/looka...
) ).
>
> 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
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Premature end of regular expression with non-ascii chara
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password