# REGEX_QUOTE proc

Source: https://ref.dm-lang.org/proc/REGEX_QUOTE
Added in BYOND 510.

### Format
- `REGEX_QUOTE(text)`
- `REGEX_QUOTE_REPLACEMENT(text)`


### Returns
- REGEX_QUOTE: A version of the text with any special regular expression characters escaped by backslashes.
- REGEX_QUOTE_REPLACEMENT: A version of the text with \$ characters escaped by a second \$.


### Args
> text: The text to escape

Quotes a piece of text so that it can be used inside a regular expression without fear of being treated as pattern instructions.

```dm /REGEX_QUOTE/
proc/FindWord(text, word)
    // The \b pattern is a word break, to search for the word
    // on its own instead of as part of another word.
    var/regex/R = regex("\\b[REGEX_QUOTE(word)]\b", "i")
    // find the pattern in the text
    return R.Find(text)
```

### See also
- [regex proc](https://ref.dm-lang.org/proc/regex.md)
- [regex datum](https://ref.dm-lang.org/regex/index.md)
- [stddef.dm file](https://ref.dm-lang.org/appendix/stddefdotdm.md)
