emptyOVO opened a new issue, #10986:
URL: https://github.com/apache/inlong/issues/10986
### Description
parent: #10796
* REGEXP_MATCHES(str, pattern): a powerful function in PostgreSQL that
matches regular expression patterns in strings and returns all matched results
### Use case
* Matching a single pattern:
Let's say we have a string from which we want to extract substrings that
match a particular pattern
REGEXP_MATCHES('The quick brown fox', 'quick')--returns {quick}
* Extract multiple subpatterns
Multiple substrings can be extracted using capture groups in regular
expressions
REGEXP_MATCHES('User: Alice, ID: 12345', 'User: (\w+), ID: (\d+)')--returns
{Alice,12345}
* Globally match multiple patterns
The g flag can be used when you want to match all the substrings that occur
REGEXP_MATCHES('foo 123 bar 456', '\d+', 'g')--returns {"123","456"}
* Case matching is ignored
Use the i flag to ignore case for matching
REGEXP_MATCHES('Hello World', 'hello', 'i')--returns {Hello}
* Multi-line pattern matching
Using the m flag allows regular expressions to match across multiple lines
REGEXP_MATCHES('First line\nSecond line', '^Second', 'm')--returns {Second}
* Some Announcements:
REGEXP_MATCHES() returns an array, so be careful about using arrays when
processing the results.
If the global flag g is not used, only the first matching substring is
returned.
### Are you willing to submit PR?
- [X] Yes, I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]