Using multiple | in JavaScript regex -


me the regex

  and check the following string form using a table and two I need to do table & amp; One more two tables and two & amp; A   

I tried with the below to see the format given above but regex is not working as I had expected match 'table & amp; One more 'string should be empty, but I'm not empty rather than math.

My regex

  / ^ (table & amp; (one more two) | (one) | (two) | (two and one)) $ / g var Match = 'table and another one' Match (/ ^ (table and (one and two) | (one) | (two) | (two & one))) $ / g); Remove brackets:  
  / ^ (table & one (two | one | two | two and one)) $ /   

There is no reason to use the g modifier. Try to match the entire string.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -