mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-07 20:46:31 +00:00
Sync Haystack API reference on Docusaurus (#10178)
Co-authored-by: anakin87 <44616784+anakin87@users.noreply.github.com>
This commit is contained in:
parent
85c27dc155
commit
93edaebe12
@ -611,7 +611,7 @@ result = parser.run(text_or_messages=messages)
|
||||
#### RegexTextExtractor.\_\_init\_\_
|
||||
|
||||
```python
|
||||
def __init__(regex_pattern: str)
|
||||
def __init__(regex_pattern: str, return_empty_on_no_match: bool = True)
|
||||
```
|
||||
|
||||
Creates an instance of the RegexTextExtractor component.
|
||||
@ -643,6 +643,7 @@ Extracts text from input using the configured regex pattern.
|
||||
|
||||
**Returns**:
|
||||
|
||||
- If match found: `{"captured_text": "matched text"}`
|
||||
- If no match and `return_empty_on_no_match=True`: `{}`
|
||||
- `{"captured_text": "matched text"}` if a match is found
|
||||
- `{}` if no match is found and self.return_empty_on_no_match=True (default behavior)
|
||||
- `{"captured_text": ""}` if no match is found and self.return_empty_on_no_match=False
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user