r1chardj0n3s/parse

Center alignment / stripping in 1.17 incompatible with 1.16

Closed this issue · 1 comments

parse 1.16

>>> import parse
>>> parse.parse("Column{:d}:{:^}", "Column 1: Timestep")
<Result (1, 'Timestep') {}>
>>> parse.parse("Column {:d}:{:^}", "Column 1: Timestep")
<Result (1, 'Timestep') {}>

parse 1.17

>>> import parse
>>> parse.parse("Column{:d}:{:^}", "Column 1: Timestep")
>>> parse.parse("Column {:d}:{:^}", "Column 1: Timestep")

The above 2 lines does not return any matches.
When removing the center alignment it gives a result, but unstripped:

>>> parse.parse("Column{:d}:{}", "Column 1: Timestep")
<Result (1, ' Timestep') {}>
>>> parse.parse("Column {:d}:{}", "Column 1: Timestep")
<Result (1, ' Timestep') {}>

If the input string has an ending whitespace, the alignment operator works:

>>> parse.parse("Column {:d}:{:^}", "Column 1: Timestep ")
<Result (1, 'Timestep') {}>

Darn! This is tricky :(