Using re in Python, I would like to return all the characters in the string that precedes the first kind of underscore. In addition, I would like the string to be returned in all capital letters and without any non-palper characters.
For example:
AG.av08_binloop_v6 = AGAV08 TL.av1_binloopv2 = TLAV1
I'm sure I know how to return a string in all uppercase letters using string.upper() , but I'm sure there are several ways to remove it effectively . . Any help would be greatly appreciated. I am still slowly but surely learning regular expressions. Each tip is added to my notes for future reference.
To clarify, my examples above are not real lines. The actual line will look like this:
AG.av08_binloop_v6
With my desired result it looks like:
AGAV08
And the following example will be the same. Line:
TL.av1_binloopv2
Required Conclusion:
TLAV1
Thanks again for your help!
python string regex
durandal
source share