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

escapes inside filter #7

Open
davewood opened this issue Jun 13, 2016 · 3 comments
Open

escapes inside filter #7

davewood opened this issue Jun 13, 2016 · 3 comments
Assignees

Comments

@davewood
Copy link
Contributor

davewood commented Jun 13, 2016

the different behaviour of single and double quotes inside of a filter is confusing to me and https://metacpan.org/pod/Data::DPath#Special-characters didnt entirely clear it up to us.

#!/usr/bin/env perl
use 5.018;
use warnings;
use Data::DPath 'dpath';

my $data = { foo => 'aaa[bbb/ccc]ddd' };

match( $data, q!/foo[value eq 'aaa\[bbb/ccc\]ddd']! );
match( $data, q!/foo[value eq 'aaa[bbb/ccc]ddd']! );
match( $data, q!/foo[value eq "aaa\\[bbb/ccc\\]ddd"]! );

sub match {
    my ($input_pl, $query_path) = @_;
    my $dpath = Data::DPath::Path->new( path => $query_path );
    my @result = $dpath->match($input_pl);
    say $query_path;
    say scalar @result ? 'match' : 'no match';
}
perl dpath.pl 
/foo[value eq 'aaa\[bbb/ccc\]ddd']
no match
/foo[value eq 'aaa[bbb/ccc]ddd']
no match
/foo[value eq "aaa\[bbb/ccc\]ddd"]
match
@renormalist renormalist self-assigned this Jun 20, 2016
@renormalist
Copy link
Owner

I see your point and agree it looks strange. Though, I don't have an answer right now. Data::DPath uses Text::Balanced - maybe we can find hints in that documentation; I need to dive deeper into this.

@renormalist
Copy link
Owner

I wonder if #18 is related to this problem and might even fix this. I appreciate any help from whoever uses it and is also confused.

@Madskill
Copy link
Contributor

Sorry! It is different problems...

@Madskill Madskill mentioned this issue Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants