Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Proposal: New Reqex Expression #10

Open
B4rb4ross4 opened this issue Aug 17, 2016 · 6 comments
Open

Proposal: New Reqex Expression #10

B4rb4ross4 opened this issue Aug 17, 2016 · 6 comments

Comments

@B4rb4ross4
Copy link

B4rb4ross4 commented Aug 17, 2016

The addition of an regex matching expression would be great. If I see it correct you can now only match literal strings with:

[?(@.title == "A string")]

I thought of something like:
[?(@.release =~ "/\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/"]

@stephenfrank
Copy link
Contributor

stephenfrank commented Sep 6, 2016

Hi Sven,

I could see that being useful :)

I've been looking around at comparable syntaxes in different languages and I see that yours is following after Ruby's ie. filename =~ /\.jpe?g$/

CSS has attribute selectors but the 'modifier/wildcard' symbol is always behind the equals sign ie. [filename*="jpg"]

I also wonder if tilde ~ is really the recognized symbol for Regex selection? Are there more examples?

@B4rb4ross4
Copy link
Author

Hi stephen,
I think I found this syntax in a Java-Implementation of Goessner JSONPath. https://github.com/jayway/JsonPath
It wasn't Ruby that I had on my mind. But I did some research and I think perl has the same syntax, which makes sense, because ruby was made as an improvement of Perl.

@B4rb4ross4
Copy link
Author

If this feature is wanted (is it?) I could provide a pr too if I have a spare day. We should just communicate, so we don't start both ;)

@stephenfrank
Copy link
Contributor

Hi Sven,

I've been really distracted by work!

I think the Java implementation looks sensible so following them should work for everyone :)

If you send a PR with one or two tests added then I'll try to merge it as soon as I can.

Thanks!

@fghber
Copy link

fghber commented Oct 12, 2020

Has this ever been tackled? Looks not, which is kinda sad since most other JSONPath implementations allow this feature in one way or another.

@martinssipenko
Copy link
Contributor

This project is now marked as abandoned and suggests using softcreatr/jsonpath as a replacement. If you think this issue is still relevant please open a new ticket under the new project.

https://github.com/SoftCreatR/JSONPath

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants