D
Diego Virasoro
Hello,
given an instance of String, str, how do you select/copy the section of
the string between two given strings START_STRING and END_STRING?
I used something like:
re = /#{STRING_BEFORE}(regular_expression)#{STRING_AFTER}/
str =~ re
middle = $1
where regular_expression is supposed to be a regular expression
selecting any character (digits, space, newline, character,
anything...).
Is this the right method? And what should I use for regular_expression?
I tried (.|\n)* but I get a "BUS error". Any other way?
Or maybe is there a method which does what I need?
(Note: I am using Ruby 1.6.4 on Solaris)
Thank you
Diego
given an instance of String, str, how do you select/copy the section of
the string between two given strings START_STRING and END_STRING?
I used something like:
re = /#{STRING_BEFORE}(regular_expression)#{STRING_AFTER}/
str =~ re
middle = $1
where regular_expression is supposed to be a regular expression
selecting any character (digits, space, newline, character,
anything...).
Is this the right method? And what should I use for regular_expression?
I tried (.|\n)* but I get a "BUS error". Any other way?
Or maybe is there a method which does what I need?
(Note: I am using Ruby 1.6.4 on Solaris)
Thank you
Diego