Valid file extension checker using Regular Expression
Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article
Given string str, the task is to check whether the given string is a valid file extension or not by using Regular Expression. The valid file extension must specify the following conditions:It should start with a string of at least one character.It should not have any white space.It should be followed by a dot(.).It should end with any one of the file extensions: ex : jpg, txt, mp3, png, ppt, .. etcExamples:Input: str =…