remove trailing newline from captured value