Update: Maybe only additions to the documentation are needed. See my next comment below.
I wasn't sure whether this should be a bug report or a feature request, so I opted for the more positive of the two.
Is your feature request related to a problem? Please describe.
When using yaml-paths
, I'd like to be able to do case-insensitive searches. I don't always know whether letters of the string I'm searching for are in upper-, lower-, or mixed-case.
Describe the solution you'd like
An option or a filter that when searching for name
will find name
, Name
, NAME
, etc.
Describe alternatives you've considered
I saw that there wasn't an option for ignoring case, so I looked for other possible solutions. Seeing that the =~
search operator for regular expressions uses a delimiter, like /
, I thought I'd try adding the case insensitive matching flag following the last delimiter, thus:
yaml-paths -Ls '=~/name/i' example.yaml
However, that didn't yield any results. When I changed name
in the search expression to match the case of letters definitely occurring in example.yaml
, I still didn't get results.
Next, I tried removing the i
regular expression flag. That yielded results, but only those that exactly matched the case of the search filter. So, that showed that the i
regular expression flag was interfering with the search.
The only workaround I could find was:
cat example.yaml | tr 'A-Z' 'a-z' | yaml-paths -Ls '=~/name/'
However, all the search results were in lower case, so it takes additional commands to find the values in their original case.
PS
If I have time, I will try to open a pull request with a possible solution for this.