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 W.Twitter: http://www.twitter.com/cwgem
I probably wasn’t too clear with what I wanted earlier, so I apologize
for that. Thanks for the help.
[0-9] is the same as \d:
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