On Mon, Nov 21, 2011 at 11:55 PM, rubix Rubix <aggouni2002 / yahoo.fr> wrote:
> I am using this code to parse a text to search the first word and see if
> the word is one of the words of an array of strings and then increment
> an index with the size of the word to parse the rest of the text

Sounds like you rather want String#scan.

> It is working good but when I try it with unicode characters, I obtain
> the letters of the first word and not the hole first word:
> str[/[\u0627-\u064A]+/,1]

Maybe your range is missing something.  I'd rather use specific
character classes for this anyway:

str.scan /\p{Word}+/ do |word|
  printf "Found word: %p\n", word
end

http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/