I have an input where a user needs to insert 24 characters. I tried to make a pipe with regExp to do this but no spaces are added.
Ive seen functions that could do this but I wanted to keep it simple with regExp.
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: 'formatBankAcc'
})
export class FormatBankAccPipe implements PipeTransform {
transform(value: string) {
if(value != null){
value.replace(/[^\dA-Z]/g, '')
.replace(/(.{4})/g, value)
.trim();
console.log(value);
}
return value;
}
}