# special characters

[JS](/web/js.md) ⟩ [value](/web/js/val.md) ⟩ [object](/web/js/val/obj.md) ⟩ [regex](/web/js/val/builtin/regex.md) ⟩ [pattern](/web/js/val/builtin/regex/pattern.md) ⟩ special characters

{% hint style="success" %}

```javascript
// need to be escaped with a backslash (\)
. ? + * ^ $ \ /
( ) [ ] { } |	
// any other character matches itself.
```

{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}

* <mark style="color:yellow;">**`.`**</mark> - any character :point\_right: [character set](/web/js/val/builtin/regex/pattern/char-set.md).
* <mark style="color:yellow;">**`?`**</mark> - [**repeat**](/web/js/val/builtin/regex/pattern/repeat.md) <mark style="color:yellow;">**0 \~ 1**</mark>, or <mark style="color:orange;">**lazy**</mark>.
* <mark style="color:yellow;">**`+`**</mark> - [**repeat**](/web/js/val/builtin/regex/pattern/repeat.md) <mark style="color:yellow;">**1 \~ ∞**</mark>.
* <mark style="color:yellow;">**`*`**</mark> - [**repeat**](/web/js/val/builtin/regex/pattern/repeat.md) <mark style="color:yellow;">**0 \~ ∞**</mark>.
* <mark style="color:yellow;">**`^`**</mark> - [**beginning anchor**](/web/js/val/builtin/regex/pattern/anchor.md), or <mark style="color:yellow;">**invert**</mark> a set :point\_right: [character set](/web/js/val/builtin/regex/pattern/char-set.md).
* <mark style="color:yellow;">**`$`**</mark> - [**end anchor**](/web/js/val/builtin/regex/pattern/anchor.md).
* <mark style="color:yellow;">**`\`**</mark> - escape.
* <mark style="color:yellow;">**`/`**</mark> - delimiter for regex in JS, for example: <mark style="color:blue;">`/abc/`</mark>.
* <mark style="color:yellow;">**`()`**</mark> - [**group**](/web/js/val/builtin/regex/pattern/group.md).
* <mark style="color:yellow;">**`[]`**</mark> - ranges, alternation, :point\_right: [character set](/web/js/val/builtin/regex/pattern/char-set.md).
* <mark style="color:yellow;">**`{}`**</mark> - times to [**repeat**](/web/js/val/builtin/regex/pattern/repeat.md).
* <mark style="color:yellow;">**`|`**</mark> - [**alternation (or)**](/web/js/val/builtin/regex/pattern/or.md).
  {% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="warning" %}

```javascript
[.+]	// ".", "+" have NO special meaning in brackets
```

{% endhint %}
{% endtab %}

{% tab title="💈範例" %}

```javascript
// code
```

{% endtab %}

{% tab title="📗 參考" %}

* [ ] [Regular Expression Quick Reference](http://regexrenamer.sourceforge.net/help/regex_quickref.html)
* [ ] Eloquent JavaScript ⟩ Regular Expressions ⟩ [Sets of Characters](https://eloquentjavascript.net/09_regexp.html#h_8EFR0DU1xd)
  {% endtab %}

{% tab title="📘 手冊" %}

* [ ] [JavaScript Guide](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide) ⟩ [Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) ⟩&#x20;
  * [ ] [escaping](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping)&#x20;
  * [ ] [Unicode property escapes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet#unicode_property_escapes)
    {% endtab %}
    {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/web/js/val/builtin/regex/pattern/special-characters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
