I am pulling values from a string but I am having a problem removing certain character.
Mandrake 9.2 (32 bit)
the index I pull from returns that, but I want to remove the (32 bit) and its length and location differ from line to line in file. I used [0:-8] but the problem was the variance in strings, so I tried this in my code
lines = re.sub(' [\d.]*', ' ', plines2)
but did not succeed.
more lines:
Redhat 7.3 (32bit)
Redhat 8.0 (32bit)
Mac OS X 10.4
Home Premium (32bit)
Linux Ubuntu Desktop 9.10
Linux Ubuntu Desktop 9.10
They vary, I want to be able to remove the 32 bit part as well as the version so that only the product name is there, it appears not on all lines as you see, some come with version and bit version but some only with one or the other.
Is this what you want?
Note that this only works if you’re guaranteed 1 set of matching parenthesis on a line…
With a slight variation, we can make it work with all the the things you have above:
This will match version strings
number.number.number...It will also match anything inside parenthesis (inclusive). Each match will be removed from the line.