What is the difference between the regular expression * and the expression .* The meaning of * is – any character occurring any number of times, and the meaning of .* is any character occurring zero or more times. Both essentially mean the same. Can somebody please explain the difference?
What is the difference between the regular expression * and the expression .* The
Share
No,
*is a quantifier that modifies the meaning of the previous character, group or character class in the regex. On its own it is meaningless. It only carries meaning when combined with what is immediately before it in the regex.So,
.*means any character occurring 0 or more times,a*meansaappearing 0 or more times, and so on.