Skip to content

Commit

Permalink
Add search syntax tip for whole word searches
Browse files Browse the repository at this point in the history
Whole word searches are very useful in situations when a normal search gives two many false positives. Let's document how to do that in Github code search, so people don't have to look that up in regext tutorials.
  • Loading branch information
nbenitez authored Nov 13, 2024
1 parent 4f241ed commit eb0ea81
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,11 @@ By default, code search is case-insensitive, and results will include both upper
```text
/(?-i)True/
```

## Whole Words

If you want your search string to be matched as a whole word, you need to use a regular expression that includes the word boundary token `\b`. For example, to search for the string "True" as a whole word, you would use:

```text
/\bTrue\b/
```

0 comments on commit eb0ea81

Please sign in to comment.