Match different REGEX in OR statement

I have different REGEX and I want to use them in following code.

The idea is that for ALL Regex the result.pop is triggered, but somehow II does not work and | also not. And only the first REGEX (in below example [2] is read and executed only.

if(tag.name.match(/[2][a-zA-Z0-9]+/ || /[3][a-zA-Z0-9]+/ || /[4][a-zA-Z0-9]+/)) {

      result.pop(

So all above (3) Regex statements should be considered in my further code, how to fix?

You need to re-write the match statement in every OR.

@Ronnehag

Hi, sorry, I do not understand, can you give me example please?
Also why would above code not work, does not make sense to me.

Thanks for helping.

if(tag.name.match(/[2][a-zA-Z0-9]+/) ||
    tag.name.match(/[3][a-zA-Z0-9]+/) || 
    tag.name.match(/[4][a-zA-Z0-9]+/)) {

    //logic
}

Why use 3 different regex though? You can combine all to one, what exactly is it you want to match? Also note that match doesn’t return a boolean, it returns the matched value.

@Ronnehag - thanks. The code is for example only and the example does not reflect what I want to do, its a bit complicated. Thanks again.