Skip to content

Commit 5cd4f77

Browse files
docs: add parenthesis back to regex literal example (#9027)
* fix: added parenthesis to literal notation example * add prettier-ignore --------- Co-authored-by: gtmnayan <[email protected]>
1 parent 7af165d commit 5cd4f77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

documentation/docs/02-template-syntax/02-basic-markup.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ Text can also contain JavaScript expressions:
113113

114114
> If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.
115115
116+
<!-- prettier-ignore -->
116117
```svelte
117118
<h1>Hello {name}!</h1>
118119
<p>{a} + {b} = {a + b}.</p>
119120
120-
<div>{/^[A-Za-z ]+$/.test(value) ? x : y}</div>
121+
<div>{(/^[A-Za-z ]+$/).test(value) ? x : y}</div>
121122
```
122123

123124
## Comments

0 commit comments

Comments
 (0)