0

I have following array:

array = ['S2A_MSIL1C_20180213T041901_N0206_R090_T46QCH_20180213T075744.SAFE','S2B_MSIL1C_20180208T041929_N0206_R090_T46QCJ_20180208T075342.SAFE','S2A_MSIL1C_20180213T041901_N0206_R090_T46QCJ_20180213T075744.SAFE','S2B_MSIL1C_20180310T041559_N0206_R090_T46QDK_20180310T075716.SAFE']

I filter this array using this regex:

regex = new RegExp('(T46QCJ|s)','g');

and apply it on the array like

var filter = array.filter(e => regex.test(e));

The output is

["S2B_MSIL1C_20180208T041929_N0206_R090_T46QCJ_20180208T075342.SAFE"]

instead of the desired result

['S2B_MSIL1C_20180208T041929_N0206_R090_T46QCJ_20180208T075342.SAFE','S2A_MSIL1C_20180213T041901_N0206_R090_T46QCJ_20180213T075744.SAFE']

Why is the second match not inserted?

dwalin93
  • 83
  • 10

0 Answers0