开发者

Using a regex pattern to find revision numbers from a svn merge

开发者 https://www.devze.com 2023-01-01 07:40 出处:网络
svn diff -rXX:HEAD Will give me a format like this, if there has been a merge between those 开发者_C百科revisions:
svn diff -rXX:HEAD

Will give me a format like this, if there has been a merge between those 开发者_C百科revisions:

Merged /<branch>:rXXX,XXX-XXX
or
Merged /<branch>:rXXX

I'm not very familiar with regex and am trying to put together a pattern which will match all the numbers (merged revision numbers) AFTER matching the "Merged /branch:r" part.

So far I have this to match the first part: [Mm]erged.*[a-zA-Z]:r

Thanks in adv. for the help :)


/[Mm]erged.*:r([\d,-]+)/

The numbers you want will be in the first capture group result.


/[Mm]erged.*?:r(\d+)(?:,(\d+)-(\d+))?/

The numbers will all be in separate capture groups - the first will always be there, the second and third are optional.

0

精彩评论

暂无评论...
验证码 换一张
取 消