Skip to content

Commit a474dfb

Browse files
committed
Deprecate gleam/regex
1 parent 8635789 commit a474dfb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
package.
77
- The `gleam/iterator` module has been deprecated in favour of the
88
`gleam_yielder` package.
9+
- The `gleam/regex` module has been deprecated in favour of the `gleam_regexp`
10+
package.
911

1012
## v0.43.0 - 2024-11-17
1113

src/gleam/regex.gleam

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
import gleam/option.{type Option}
77

8+
@deprecated("Please use the gleam_regexp package instead")
89
pub type Regex
910

1011
/// The details about a particular match:
1112
///
13+
@deprecated("Please use the gleam_regexp package instead")
1214
pub type Match {
1315
Match(
1416
/// The full string of the match.
@@ -20,6 +22,7 @@ pub type Match {
2022

2123
/// When a regular expression fails to compile:
2224
///
25+
@deprecated("Please use the gleam_regexp package instead")
2326
pub type CompileError {
2427
CompileError(
2528
/// The problem encountered that caused the compilation to fail
@@ -30,6 +33,7 @@ pub type CompileError {
3033
)
3134
}
3235

36+
@deprecated("Please use the gleam_regexp package instead")
3337
pub type Options {
3438
Options(case_insensitive: Bool, multi_line: Bool)
3539
}
@@ -52,6 +56,7 @@ pub type Options {
5256
/// // -> True
5357
/// ```
5458
///
59+
@deprecated("Please use the gleam_regexp package instead")
5560
pub fn compile(
5661
pattern: String,
5762
with options: Options,
@@ -89,6 +94,7 @@ fn do_compile(
8994
/// // ))
9095
/// ```
9196
///
97+
@deprecated("Please use the gleam_regexp package instead")
9298
pub fn from_string(pattern: String) -> Result(Regex, CompileError) {
9399
compile(pattern, Options(case_insensitive: False, multi_line: False))
94100
}
@@ -108,6 +114,7 @@ pub fn from_string(pattern: String) -> Result(Regex, CompileError) {
108114
/// // -> False
109115
/// ```
110116
///
117+
@deprecated("Please use the gleam_regexp package instead")
111118
pub fn check(with regex: Regex, content string: String) -> Bool {
112119
do_check(regex, string)
113120
}
@@ -126,6 +133,7 @@ fn do_check(regex: Regex, string: String) -> Bool
126133
/// // -> ["foo", "32", "4", "9", "0"]
127134
/// ```
128135
///
136+
@deprecated("Please use the gleam_regexp package instead")
129137
pub fn split(with regex: Regex, content string: String) -> List(String) {
130138
do_split(regex, string)
131139
}
@@ -186,6 +194,7 @@ fn do_split(regex: Regex, string: String) -> List(String)
186194
/// // -> []
187195
/// ```
188196
///
197+
@deprecated("Please use the gleam_regexp package instead")
189198
pub fn scan(with regex: Regex, content string: String) -> List(Match) {
190199
do_scan(regex, string)
191200
}
@@ -210,6 +219,7 @@ fn do_scan(regex: Regex, string: String) -> List(Match)
210219
/// replace(each: re, in: "a,b-c d+e", with: "/")
211220
/// // -> "a/b/c/d/e"
212221
/// ```
222+
@deprecated("Please use the gleam_regexp package instead")
213223
@external(erlang, "gleam_stdlib", "regex_replace")
214224
@external(javascript, "../gleam_stdlib.mjs", "regex_replace")
215225
pub fn replace(

0 commit comments

Comments
 (0)