Skip to main content

Text.to_regex

to_regexcase_insensitive

Group: Text

Documentation

Compile the text into a regex pattern that can be used for matching.

If an empty regex is used, compile throws an Illegal_Argument error.

Arguments

  • case_insensitive: Enables or disables case-insensitive matching. Case insensitive matching behaves as if it normalises the case of all input text before matching on it.

Remarks

Why Compile?

While many regex engines are able to cache ad-hoc patterns, it is often useful to be able to manually retain a pattern that you have computed. This function exists so you can hold onto the resultant Pattern object, instead of immediately proceeding to match using it.