Sobes.tech
Junior — Middle

Can you explain what the dot means in regular expression syntax?

sobes.tech AI

Answer from AI

In regular expressions, the dot (.) is a special character that matches any single character except a newline character (depending on the settings).

For example, the regular expression a.c will find strings where the letter "a" is followed by any character, and then "c":

  • "abc" — matches
  • "a-c" — matches
  • "ac" — does not match (missing a character between a and c)

If you want the dot to be interpreted as a normal character, you need to escape it with a backslash: \..