mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
📝 Docs: 添加 RegexMatched
依赖注入文档 (#2618)
Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
parent
0622e16d18
commit
236e4ea9aa
@ -948,6 +948,34 @@ async def _(foo: Namespace = ShellCommandArgs()):
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexMatched
|
||||
|
||||
获取正则匹配结果的对象。
|
||||
|
||||
<Tabs groupId="python">
|
||||
<TabItem value="3.9" label="Python 3.9+" default>
|
||||
|
||||
```python {4}
|
||||
from re import Match
|
||||
from typing import Annotated
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Annotated[Match[str], RegexMatched()]): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="3.8" label="Python 3.8+">
|
||||
|
||||
```python {3}
|
||||
from re import Match
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Match[str] = RegexMatched()): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexStr
|
||||
|
||||
获取正则匹配结果的文本。
|
||||
|
@ -948,6 +948,34 @@ async def _(foo: Namespace = ShellCommandArgs()):
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexMatched
|
||||
|
||||
获取正则匹配结果的对象。
|
||||
|
||||
<Tabs groupId="python">
|
||||
<TabItem value="3.9" label="Python 3.9+" default>
|
||||
|
||||
```python {4}
|
||||
from re import Match
|
||||
from typing import Annotated
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Annotated[Match[str], RegexMatched()]): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="3.8" label="Python 3.8+">
|
||||
|
||||
```python {3}
|
||||
from re import Match
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Match[str] = RegexMatched()): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexStr
|
||||
|
||||
获取正则匹配结果的文本。
|
||||
|
@ -948,6 +948,34 @@ async def _(foo: Namespace = ShellCommandArgs()):
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexMatched
|
||||
|
||||
获取正则匹配结果的对象。
|
||||
|
||||
<Tabs groupId="python">
|
||||
<TabItem value="3.9" label="Python 3.9+" default>
|
||||
|
||||
```python {4}
|
||||
from re import Match
|
||||
from typing import Annotated
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Annotated[Match[str], RegexMatched()]): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="3.8" label="Python 3.8+">
|
||||
|
||||
```python {3}
|
||||
from re import Match
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Match[str] = RegexMatched()): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexStr
|
||||
|
||||
获取正则匹配结果的文本。
|
||||
|
@ -948,6 +948,34 @@ async def _(foo: Namespace = ShellCommandArgs()):
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexMatched
|
||||
|
||||
获取正则匹配结果的对象。
|
||||
|
||||
<Tabs groupId="python">
|
||||
<TabItem value="3.9" label="Python 3.9+" default>
|
||||
|
||||
```python {4}
|
||||
from re import Match
|
||||
from typing import Annotated
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Annotated[Match[str], RegexMatched()]): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="3.8" label="Python 3.8+">
|
||||
|
||||
```python {3}
|
||||
from re import Match
|
||||
from nonebot.params import RegexMatched
|
||||
|
||||
async def _(foo: Match[str] = RegexMatched()): ...
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### RegexStr
|
||||
|
||||
获取正则匹配结果的文本。
|
||||
|
Loading…
Reference in New Issue
Block a user