python regex for operating system name
Question: I am trying to get regex for operating system name: Windows XP, Windows Vista,
Windows 7, Windows 8, windows 8.1 and windows server 2008 R2

Normally the operating system name is in a line, for example: Operating
System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1
(7601.win7sp1_gdr.140303-2144) I tried this regex `:\s*(\w+\s*\w*\.\w|\s])`

which is only good till Windows 8.1, what would be a good regex for all the
above mentioned operating system name. Have been trying for hours thank you
for help.


Answer: You don't need regex. Use this:

    
    
    >>> import os
    >>> os.name
    'posix'
    >>> import platform
    >>> platform.system()
    'Linux'
    >>> platform.release()
    '2.6.22-15-generic'
    

This works for all operating systems.

