Is it possible to replace the bank account number ...
# general
g
Is it possible to replace the bank account number on an advanced PDF template to only show the last 4 digits and replace the prior numbers with
X
instead? i.e.
123445456
- becomes
XXXXX5456
m
<#assign account = “123445456”> ${account[5..]}
You can write this even shorter with say… ${bankaacountfieldid[5..]}
bankaacountfieldid being the field id
“XXXXX”${account[5..]}
You may not need the quotes around XXXXX
d
here's some regex to do it, just because ¯\_(ツ)_/¯
${account?replace('.(?=.{4,})', 'X', 'r')}
🎉 2
alternatively:
${account[account?length-4..]?left_pad(account?length, 'X')}
this handles the length of the account number not being constant *the regex solution also does this