Hey,
I'm not the best at regex so I came here for some help!
I'm trying to match all integers before and after the hyphen:
12345-5
This is what I tried but always returns null
ThanksCode:var divID = '12345-5'; var idPattern = /^[0-9]+$/; //Matching one or more numbers before the hyphen var id2Pattern = /^\-[0-9]+$/; //Matching starts from the hyphen and all numbers that proceed var id2 = divID.match(id2Pattern); alert(id2);









Bookmarks