How to split a large text using RegEx pattern?

Good day, there is a great text to parse out.

Before identified the problem, breaking up the text using split (/[\r?\n]+/) everything worked like clockwork, then you could use match, walk the array and find the right match('^[0-9]{3,4}[XX ]+[0-9]{3,4}$')

But then it turned out that my split is not appropriate, as it is designed to break if there is a space or comma

Here are the possible options that I need to sort out
1280x720
1280x720 (x Cyrillic)
1280 x 720
1280 x 720 (x Cyrillic)

T..e if I break the text and the text will be that's 1280 x 720 then I won't be able to find this piece.
I can tell you how to properly implement this solution?
March 20th 20 at 11:23
1 answer
March 20th 20 at 11:25
Solution
It?
var txt = `1280x720,
1280x720 (x Cyrillic)
1280 x 720
1280 x 720 (x Cyrillic)`;
var arr = txt.split(/(?:,?\r?\n)+/);
console.log(arr)


https://regex101.com/r/asozT9/4
I just test and it turns out you can match to apply to the entire text and don't need to break the array.
So txt.match(/[0-9]{3,4}[XX ]+[0-9]{3,4}/g)
Can tell correctly formed expression? Like all work properly, just before it was match('^[0-9]{3,4}[XX ]+[0-9]{3,4}$') but it only works if the array goes through - niko.Rueck commented on March 20th 20 at 11:28
@leonel, In the last expression, the end of the line unnecessary, if I understand correctly what you need.
Here clearly
https://regex101.com/r/asozT9/2 - halie47 commented on March 20th 20 at 11:31
@Jeffery_Cronin, Tested, and not quite works well as it is necessary sometimes produces here such
[ '237 000', '912x512' ]
And I need to were given only to those where there is x with or without spaces - niko.Rueck commented on March 20th 20 at 11:34
@Jeffery_Cronin, https://regex101.com/r/asozT9/3 - niko.Rueck commented on March 20th 20 at 11:37
@leonel, https://regex101.com/r/asozT9/4 - halie47 commented on March 20th 20 at 11:40
@Jeffery_Cronin, thank you so much, a little rewritten [0-9]{3,4}(?:\s+)?[XX](?:\s+)?[0-9]{3,4} because the match did not want to work - niko.Rueck commented on March 20th 20 at 11:43

Find more questions by tags JavaScriptRegular expressionsNode.js