I want to search for a line which starts with lets say a and ends with z. In-between any number of any character can come. How can i write an expression for this? ( I dont want to explicity mention any digits, any special chars, any alphabets ) I don't to do something like ^[0-9,a-z,A-Z,list all special chars]*$.
How about:
^a.*z$
Run Code Online (Sandbox Code Playgroud)
. is the regex metacharacter that matches anything.
* is a greedy modifier that repeats the previous item 0 or more times, trying for the biggest number of matches first, followed by smaller permutations until the preceding item cannot be matched at all, which will in fact, still make the overall regex match.