ruby regexp as input pattern fix