Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contains all the given substrings in string (contains_all) #417

Closed
saeed-mcu opened this issue Aug 27, 2023 · 2 comments · Fixed by #468
Closed

contains all the given substrings in string (contains_all) #417

saeed-mcu opened this issue Aug 27, 2023 · 2 comments · Fixed by #468
Assignees
Labels
type: feature A value-adding code addition that introduce new functionality.

Comments

@saeed-mcu
Copy link

I want to determines whether the string matches all the given substrings or not. (all of them MUST contains)
Is it possible to all substrings are checked in a single pass over the target string to achieve good performance advantage over multiple calls to single contains function.

if contains_all function added in String functions of VRL , it can be very useful and applicable for log parsing.

@StephenWakely StephenWakely added the type: feature A value-adding code addition that introduce new functionality. label Sep 14, 2023
@pront
Copy link
Collaborator

pront commented Sep 15, 2023

Hi @saeed-mcu, is the following example what you were thinking?

contains_all("The Needle In The Haystack", "Needle", "Haystack") # returns true

If yes, that seems reasonable.

@saeed-mcu
Copy link
Author

Hi @pront , is the following example return false ?

contains_all("The Needle In The Haystack", "Needle", "not_exist") 

I expected , all substring exist in the string not one of them.
so I expected above example return false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants