Skip to content

Commit 5865c6d

Browse files
committed
document native regex syntax
1 parent d8f7760 commit 5865c6d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

misc_docs/syntax/extension_regular_expression.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ summary: "This is the `regular expression` extension point."
66
category: "extensionpoints"
77
---
88

9+
> Deprecated in favor of native regular expression syntax in v12+
10+
911
`%re` is used to create JavaScript regular expressions.
1012

1113
<CodeTab labels={["ReScript", "JS Output"]}>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
id: "regular-expression-syntax"
3+
keywords: ["regular", "expression", "regex"]
4+
name: "/re/"
5+
summary: "This is the `regular expression` syntax."
6+
category: "languageconstructs"
7+
---
8+
9+
> Available in v12+
10+
11+
You write regular expressions in ReScript just like you do in JavaScript.
12+
13+
<CodeTab labels={["ReScript", "JS Output"]}>
14+
15+
```res
16+
let regex = /^hello/
17+
let result = regex->RegExp.test("hello world")
18+
```
19+
20+
```js
21+
let regex = /^hello/;
22+
23+
let result = regex.test("hello world");
24+
```
25+
26+
</CodeTab>
27+
28+
### References
29+
30+
* [Regular Expressions](/docs/manual/latest/primitive-types#regular-expression)
31+
* [RegExp API](/docs/manual/latest/api/core/regexp)

0 commit comments

Comments
 (0)