The match
function takes in a regex
From your description it looks like you need to match the word DRACHMAN
. This we can match using /DRACHMAN/
. You also need to match everything after that (.)*
Therefore we can finally merge
initialData = {
address: "Bla..Bla..Bla.. 421 E DRACHMAN TUCSON AZ 5705-7598 USA"
};
data = {
...this.initialData,
address: this.initialData.address.match(/DRACHMAN(.)*/)
};
Have a look at this fork
CLICK HERE to find out more related problems solutions.