Here is my stab at it:
if f3_entry =~ /(>*\_*\_*\_F3)/
f3_out.puts f3_entry
end
Obviously, it doesn't work. I need to match whatever is between those
underscores. Am i going in the right direction? Thanks in advance!
If that's all you need then I'd just use split and call it a day:
irb(main):001:0> "1_9_1912_F3".split(/_/)=> ["1", "9", "1912", "F3"]
Regards,Chris WhiteTwitter: http://www.twitter.com/cwgem
and * means 0 or more, which I'm not sure it's really what you need. If you
don't want to check for a specific number of digits but need 1 or more use +
/>\d+_\d+_\d+_F3/
If you want to limit to specific number of digits, you can use {a} to
specify a range of numbers (or range of numbers), or no quantifier it it's
exactly one occurence. For example:
/>\d_\d_\d{4}_F3/
which means, match >, then a digit, then _, then another digit, then another
_, then 4 digits, then _F3
Jesus.
···
El 09/09/2011 17:26, "Cyril J." <cyril.varghese.jose@gmail.com> escribió:
Thanks Pat rubular helped a lot.
I used :
([0-9]*[_][0-9]*[_][0-9]*[_])
I probably wasn't too clear with what I wanted earlier, so I apologize
for that. Thanks for the help.