Could you tell me how to write the regular expression required like this?

recently, regular matching is required for input:
for example, input can only be 60G, 1T is preceded by a number, followed by a capacity unit;
there is a 60G/ month; the front numerical unit of 50G/ half a year is also followed by this kind of control requirement of the unit;
how should a similar regular expression be written? Thank you


/\d+[KMGT](\/(|))?/

d + any
of more than one number
[KMGT] unit (/ (month | half a year)? Optional units of time


'60G/'.match(/^\d+(G|T)(\/\W{1,2})?/g)//["60G/"]
'60G'.match(/^\d+(G|T)(\/\W{1,2})?/g)//["60G"]
'1T'.match(/^\d+(G|T)(\/\W{1,2})?/g)//

is not so perfect, for reference only


/^\d+[KMGT](?:\/(?:|?))?$/i
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e577e7-44c76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e577e7-44c76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?