javascript - Regex match with 3 condition? -


i creating math program .if wish solve need separate equation using regex. for example:

     `10x-10y2+100x-100k=100`    

the format separate regex output: "10x" ,"100x" ,"100k" ,"10y2","100"

i have code separate match function

there are:

           num[a-z]num : ` /([\-+])?\s*(\d+)?([a-z]?(\d+))/g`            num[a-z]    : ` /([\-+])?\s*(\d+)?([a-z]?(\d+))/g`            fon num         : `/\b[+-]?[\d]+\b/g` 

i need 3 match function within 1 regex match function.some 1 combine code single regex expression

note :i need match function not split beacause apply regex expression parser

thank you.

split on symbols:

"10x-10y2+100x-100k=100".split(/[-+=]/); 

output:

["10x", "10y2", "100x", "100k", "100"] 

if need use match() method suggest same approach:

"10x-10y2+100x-100k=100".match(/[^-+=]+/g); 

output same.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -