I want to much Redmine issue numbers in Version Control commit messages, which are numbers preceded by a # sign, eg #123, #456 etc, but I only want to match them if they are surrounded by a punctuation character set, or are the beginning or end of the line. eg '#234aa, #567' should match only #567. ', - ;#456,,' should match #456 because ',-; ' are all in the punctuation character set. I have tried an example expression
function myFunction()
{
var str="erwet,#3456 #623 #345 fdsfsd";
var n=str.match(/\#[\d+]+[\s]/g);
document.getElementById("demo").innerHTML=n;
}
I also want to match them into an array or a list, but the demo I am trying matches them into a single string.