Q:

Regex for multiple number variations + alphanumeric suffix

How can i write a regex pattern to match all variations of floats and integers (seperated by a dot or comma) with a two characters alphanumeric suffix (with a space or not) in a long text something like this:
34MB
34 MB
34.3MB
34,3MB
34.30MB
34,30MB
34,30 MB
5MB
5 MB
1.024MB
1.024 MB
1,024MB
10,67MB
10.67MB

Is it possible? I tried something like this but not working
/(\d+(.|,\d+)?\s\MB|KB|GB|TB)/

A:

Maybe this does the trick:
(\d+(?:[.,]\d+)?)\s?([MKGT]B)

EDIT: Honoring the post of @FailedDev, you might append a \b to match word boundaries. Thus, it won't match 1200MBPS, but 1200MB.

