re = /[\xC0-\xD6\xD8-\xF6\xF8-\xFF\x{100}-\x{2AF}\x{388}-\x{3EF}]/m
str = 'Different languages to test:
Napiszę tutaj trochę po polsku, żeby uzyskać znaki specjalne. To jest tylko do testowania. Szybki brązowy lis przeskoczył nad leniwym psem.
Unë thjesht do të shkruaj disa gjëra shqipe këtu për të marrë karaktere të veçanta. Kjo është vetëm për testim. Dhelpra e shpejtë kafe u hodh mbi qenin dembel.
Mən burada xüsusi personajlar əldə etmək üçün bir az azərbaycanca yazılar yazacam. Bu sadəcə sınaq üçündür. Sürətli qəhvəyi tülkü tənbəl itin üstündən atladı.'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html