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

**URL:** <https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99550>\
**Category:** Ruby\
**Created:** [January 31, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99550 "2006-01-31T19:57:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 31, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99550/1 "2006-01-31T19:57:21Z")

</div>

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_)  
([Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions](http://www.regular-expressions.info/lookaround.html)) ).

Please let us all know if you still encounter problems.

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 31, 2006, 9:07pm UTC](https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99550/2 "2006-01-31T21:07:39Z")

</div>

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
