Sometimes, while working with Python strings, we can have a problem in which we need to test for string if its a valid excel column. This has application in many domains including day-day programming, web development and Data Science. Lets discuss certain way in which this task can be performed.
Method : Using
re.match() + group()
The combination of above functions can be used to perform this task. In this, we perform regex match() to match with the potential updated excel version which have A-XDF, and starts with 0-9 followed by 0-6 characters not exceeding 1048576. The groupby() is used to group the elements on that basis.
The original string is : C101 Is string valid excel column : True
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course