Currently, I am facing a challenge in creating a new array of strings by filtering another array for a specific pattern.
For example:
let originalString = "4162416245/OG74656489/OG465477378/NW4124124124/NW41246654"
I believe this pattern can be found in the given string as well. However, my initial approach was to split the string at each / :
let splitArr = originalString.split('/');
// splitArr = ["4162416245", "OG74656489", "OG465477378", "NW4124124124", "NW41246654"]
Essentially, I need to create two different arrays that are filtered based on the starting pattern of these strings. OG and NW are fixed prefixes that won't change, but I am unsure about the numbers that follow. The backend sends this data as OG(original ticket) and NW(new ticket), so these prefixes are constant. I need to identify strings starting with these prefixes and place them in their respective arrays:
ogArr = ["OG74656489", "OG465477378"]
nwArr = ["NW4124124124", "NW41246654"]