From: Chananya Freiman Date: 2010-12-29T08:27:54+09:00 Subject: Ruby array to C pointer I want to use Ruby arrays as C pointers in an extension. As far as I know, this isn't possible directly, since Ruby arrays can contain any Ruby object (hence why their internal type is VALUE). Making a new C array (static for my needs) each call and going over every element of the Ruby array and converting it wouldn't be really nice performance-wise. Is there some way to still cast the array to a C pointer of a specific type? I only want to get flat arrays of floating point numbers, but I can't find a way to get the actual address of the Ruby array. Should I instead Array#pack my arrays into binary strings? Now, in a completely unrelated subject. I keep noticing that regular expressions really don't work in a specific setting, where you want to get blocks that reside inside some sort of "tags". An example for this would be HTML. I can't find a way to cleanly find blocks that can contain any character sequence between two specific tags. Here's a small example (the tags could be anything, just chose familiar XML tags): aaa text bla bla could contain "" in strings There are two problems with this example: first of all, it would obviously parse it wrong because of the "", but even assuming that string isn't there, it will still fail if you try to search for every letter between the tags (as in .*) because it will only stop at the last encounter of . Right now I only look for the opening tags, split the data at each encounter, and then for each resulting block search for the closing tag. It doesn't fix the first problem, but it does fix the second one. Is there a clean way to do this? Thanks for any help :) -- Posted via http://www.ruby-forum.com/.