arrays - Split value in javascript in group of one, two and three


Keywords:javascript 


Question: 

I am trying to find a regular expression to split this value:

307AF53DA584

into this:

3:07:AF5:3DA:584

I tried this: var [V, A, L, U, E] = ( myString.split( /(?=(?:...)(?:..)*$)/ ) );

But got this result: 3:07:AF:53:DA

The value will always be 12 characters.

Thanks!


1 Answer: