mardi 11 août 2015

VB.NET: Pattern matching software builds

I need to check if a XML document contains some software build numbers

normally they're like ######, where: - First two characters are numbers - Third character is a letter in uppercase - last three characters are numbers

Example: 10B329 or 11A465.

But there could be some exceptions, like 8L1 or 11B465a. (if there's another character after the sixth, it's always a letter in lowercase).

I think they're always with a minimum lenght of 3 characters and a maximum lenght of 7 characters.

So what could be the best pattern to match? I tried this but it doesn't work since it takes also words...

Dim BuildPattern As String = "<key>[0-9A-Z]*</key>"

Aucun commentaire:

Enregistrer un commentaire