Quote:
Originally Posted by eschwartz
I guess you could then regex the number to strip trailing zeroes and periods. But that might require raising the complexity to a General Program Mode template -- I believe formatting comes after functions.
So:
Code:
program:
formatted_series = finish_formatting(
field('series_index'),
'4.1f',
'',
''
);
stripped_series = re(
formatted_series,
'^ \[(.*)[.0]+\]$',
' [\1] '
);
# Add together the final result
strcat(
field('series'),
stripped_series,
field('title')
);
|
Good thing I've learned regex last semester so I can understand what is going on! Hmmm...I've pretty much copied and pasted the code you provided to the template, but this still doesn't change
[01.0] to
[01].
Do you mind explaining to me what '
^ ' and '
$' from
'^ \[(.*)[.0]+\]$' does? If I remember correctly, ^ means negate? I'm not quite sure what the $ at the end does though.
Also, do we not need to escape the brackets from
' [\1] '?
Sorry for asking so many questions!