Menu

.Net Regex - HELP!

Help
2009-04-02
2013-05-01
  • Paul Hester

    Paul Hester - 2009-04-02

    I wish to make it a requirement that when a user does a commit, he must have at least one line with something on it & also, it should end with "Defect: xx" (added automatically by tortoise).
    I've tried the following on a .NET regex testing website & it works
    (.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*
    However, it always fails (i.e. never matches) when I use it in svn notify:
    <CommitRequirement Description="Defect Number" Regex="(.+\n)+(.*\n)*Defect: \d+(\s*,\s*\d+)*"/>

    Accept example:
    Commit Msg
    Defect: 23

    Reject example:
    Defect 23

     
    • Paul Hester

      Paul Hester - 2009-04-02

      Sorry, I mean it always passes even when I have nothing before the "Defect: xx" line - so in previous message, the "Reject example" is allowed

       
    • mmckechney

      mmckechney - 2009-04-23

      Paul,
      You got me on this one! The code used to run the regular expression check simply takes your regular expression string and creates the .NET Regex class:

      new Regex(config.CommitRequirements.CommitRequirement[i].Regex);

      There are no other options set to it. The commit log message is retrieved via the "svnlook log" process which with my testing doesn't add any extra information or line breaks other than what is in the actual log. I wonder it Tortoise is adding something extra to the message that is allowing the Regex to match?

      Mike

       
      • Paul Hester

        Paul Hester - 2009-04-29

        OK thanks for checking Mike. If I come across a solution, I'll let you know.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.