- **Epistemic status:** #budding ![[wildcard-character.svg]] A wildcard character in software is a symbol that serves as a placeholder for one or more characters in a string. Two of the most common wildcard characters are the asterisk (`*`) representing 0 or more characters and the question mark (`?`) representing a single character. Often it is used to do a search for a particular pattern in a string instead of typing the full string. ## Examples **Regular Expressions (`.`)** The wildcard character `.` in regular expressions matches any character. If you write a regular expression, such as `a.b` it will match a string that starts with `a`, any other character, and then `b`. **Unix and Windows Terminals** On either of these terminals you can rename a set of files in a directory using the wildcard character `*` that has the correct extension matching the search and replacement. ```shell rename *.txt *.md ``` **SQL** There are various wildcard characters in SQL, and one of the most common used when selecting all the columns is the asterisk (`*`). ```sql SELECT * from customers; ``` The `LIKE` operator is used to match specific patterns when performing a query in a column. The percent sign (`%`) matches 0 or more characters, and the underscore (`_`) matches one character. > Note - MS Access uses asterisk (`*`) instead of percentage (`%`) and question mark (`?`) instead of underscore (`_`). ```sql SELECT * FROM customers WHERE name LIKE 'B%' ``` This example will return Billy, Bob, and Bernadette if they were in the database. --- ## References - “Regular Expression.” In _Wikipedia_, October 30, 2021. <https://en.wikipedia.org/w/index.php?title=Regular_expression&oldid=1052699573>. - “SQL Wildcard Characters.” Accessed November 1, 2021. <https://www.w3schools.com/sql/sql_wildcards.asp>. - “Wildcard Character.” In _Wikipedia_, August 19, 2021. <https://en.wikipedia.org/w/index.php?title=Wildcard_character&oldid=1039627998>. - EDUCBA. “Wildcard Characters | Reason Why We Use Wildcard Characters?,” October 11, 2019. <https://www.educba.com/wildcard-characters/>.