# regex proc

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

### Format
- `regex(pattern, flags)`
- `regex(Regex)`


### Returns
> A new /regex datum.

### Args
- `pattern`: The pattern string to search for
- `flags`: (optional) A text string containing any combination of modifier flags
- `Regex`: an existing /regex datum to copy


Creates a [regular expression](https://ref.dm-lang.org/notes/regex.md), stored in a /regex datum, that can be used for searching and/or replacing text.

### See also
- [Regular expressions](https://ref.dm-lang.org/notes/regex.md)
- [regex datum](https://ref.dm-lang.org/regex/index.md)
- [regex procs](https://ref.dm-lang.org/regex/proc/index.md)
- [findtext proc](https://ref.dm-lang.org/proc/findtext.md)
- [replacetext proc](https://ref.dm-lang.org/proc/replacetext.md)
- [splittext proc](https://ref.dm-lang.org/proc/splittext.md)
- [REGEX_QUOTE proc](https://ref.dm-lang.org/proc/REGEX_QUOTE.md)
