RegEx in C#, getting the values without criterias -


i terrible @ regex, in code below want actual numbers between sh: , , or end of line. how can achieve this?

    [testmethod]     public void sandbox()     {         var regex = new regex(@"sh\:(.*?)(\,|\z)");         var matches = regex.matches("some text|sh:0000000000,sh:1111111111");          foreach (var match in matches)         {             console.out.writeline(match);               /* getting              sh:0000000000,              sh:1111111111              */               /* wanting              0000000000              1111111111              */         }     } 

just change loop below

foreach (match match in matches) {     console.out.writeline(match.groups[1].value); } 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -