I'm trying to get a regex to split a hexadecimal string by specific number patterns (7330,7331,7332,7337,7339) in Javascript. I pieced together a regex to do this: (733[0,1,2,4,7,9]{1})
.
The problem I have is that when I begin to split the string String.split(/(733[0,1,2,4,7,9]{1})/g)
, the actual regex match is being split from the rest of the string, when the match should remain part of the string.
Clearly I am not approaching this correctly. How can I ensure the string is split before the regex match?
Expected Behaviour
733000FF9F
7331334a4080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808042
7331334a7080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808012
7331334aa0808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080e2
7331334ad080808080808080808080808080808080807f808282807f7f7f8080817f7f818282807e7f807e7a7e8281807a828e8c7fa3
7331334b007c7e80827c7a7b817f7e889193826b81a4916a596d8a8a70777f777677908e806b677d785b6b9a957560787eadbf9c927a
7331334b307b83838e968a72586770798a99a1948da2ab9f927a665f726c61574c576b7f7d756c363ec9ebc09c7787807879959a6360
7331334b604f658c988885909c98868b93947c5a697c84807382938a7f86897c7677776d544b4d404d91c9c1978295aca297978769e6
7331334b906062727d796e717e8f9fa0a091867788a19f7f5b596471738082716b676b6e673643b2d3b78e82999f98837d7461617764
7339FF00
Actual Behaviour:
7330
00FF9F
7331
334a4080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808042
7331
334a7080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808012
7331
334aa0808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080e2
7331
334ad080808080808080808080808080808080807f808282807f7f7f8080817f7f818282807e7f807e7a7e8281807a828e8c7fa3
7331
334b007c7e80827c7a7b817f7e889193826b81a4916a596d8a8a70777f777677908e806b677d785b6b9a957560787eadbf9c927a
7331
334b307b83838e968a72586770798a99a1948da2ab9f927a665f726c61574c576b7f7d756c363ec9ebc09c7787807879959a6360
7331
334b604f658c988885909c98868b93947c5a697c84807382938a7f86897c7677776d544b4d404d91c9c1978295aca297978769e6
7331
334b906062727d796e717e8f9fa0a091867788a19f7f5b596471738082716b676b6e673643b2d3b78e82999f98837d7461617764
7339
FF00