jagtap.suhas wrote:/(?:bugs?|issues?|reports?)+:?\s+(?:#(?:\d+)[,\.\s]*)+/i
This one is not working for me....
Currently i am using Following regex, which is working for single bug id.
Bug Link Regex Pass 1:- /\b(?:bug|issue|task)\s*[#]{0,1}(\d+)\b/i
Bug Fixed Regex Pass 1:- /\bfix(?:ed|es)\s+(?:bug|issue|task)?\s*[#]{0,1}(\d+)\b/i
Any idea ?
anyway... I can see why, because your pattern only take into account one occurence of an issue id: [#]{0,1}(\d+)
(which means by the way "one series of digits preceeded by one or no #")
Besides, "[#]{0,1}" is better written as: "#?". That's the meaning of the "?" when placed after the letter. So let's use this one instead.
if you want this occurence to be repeated you need to:
- encapsulate the expression in a new pair of parenthesis, for instance: (#?(\d+))
- and specify how many occurences: "+" at least one ? or "*" zero or at least one. Then at the end if we want at least one: (#?(\d+))+
But here we don't take into account yet the separator between the different mantis ID. If you want to use a space, or a comma, you must add also the separator inside. For instance [\s,] for allowing comma or space as separator. Of course it could happen that there is only one mantis issue concerned, so we must use the star * to say that there is zero or more of one character among [\s,]:
(#?(\d+)[,\.\s]*)+
Finally the full expression would be:
Bug Link Regex Pass 1:-
- Code: Select all
/\b(?:bug|issue|task)\s*(#?(\d+)[,\.\s]*)+\b/i
Bug Fixed Regex Pass 1:-
- Code: Select all
/\bfix(?:ed|es)\s+(?:bug|issue|task)?\s*(#?(\d+)[,\.\s]*)+\b/i
Try this, and tell us back if it's OK.
AlainD.
ti lamp, ti lamp n'arivé!
Mantis: 1.2.5
PHP: 5.2.0
OS: Linux (etch)
Plugins: MantisGanttChart | Mantis Graphs | Source Control Integration | Subversion / WebSVN Integration