Reputation: 49
i want to replace 2 string by 2 values in some time. when i do this.
date1="Date (1995,12,17)"
this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)
it work perfectly. but when i do this:
this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)
this.formControlValue=this.formControlValue.replace(/\$RepEndDate/i,date2)
just the first string is replaced,the other string is not converted. how can i replace 2 string in some time?
Upvotes: 1
Views: 151
Reputation: 1506
easily:
this.formControlValue=this.formControlValue.replace(/\$RepStartDate/i,date1)
.replace(/\$RepEndDate/i,date2)
replace() return string you can replace it again.
Upvotes: 1