A Friday Regex Head Scratcher

"Jon Earle" <[email protected]>
Newsgroups gmane.user-groups.linux.ottawa.general
Message-ID <[email protected]>
Hey folks,

Probably simple, but the answer is eluding me at the moment.  I have a block
of text that contains:

some text PR 1234 more text

and I want to convert the number to a link to the issue in the bug reporting
database.  This is no problem, there is a regex to do just that:

             (\b(PR|SCR)[:s#]?\s?) # PR or SCR followed by :|s|#|whitespace
             (\s[a-z0-9-]+\/)?     # a category name & a slash (optional)
             ([0-9]+)              # the PR number

and that works perfectly.  Now, suppose that the block of text contains:

some text PR 1234, 5678 ,2345 more text

How would I need to adjust the regex to account for the unknown number of
additional comma-number sequences so that they can each be htmlified?

I need to inject this into both perl and python code.

Thanks for any thoughts!
Jon

-- 
OCLUG general discussion list
[email protected]
http://oclug.on.ca/mailman/listinfo/oclug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.