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

regex_match #88

Closed
kassio opened this issue Oct 12, 2011 · 5 comments
Closed

regex_match #88

kassio opened this issue Oct 12, 2011 · 5 comments

Comments

@kassio
Copy link

kassio commented Oct 12, 2011

Hello guys.. I'm understand that not Areal#matches intention to match with a regexp(#61), but would be interesting if areal offer that with other method(I don't know, something like Areal#regex_match).

Have some situations where we need search with a regexp, e.g. search for some file content_type.

The column: ['image/png', 'image/jpeg', 'image/gif', 'application/pdf', 'application/x-shockwave-flash']

And I want to select only images and flashs file. Would be interesting use:

table[column].regex_match('.(image|flash).').

Thank's

@stevecj
Copy link

stevecj commented Oct 25, 2011

I just got a code spike working for doing that in PostgreSQL and MySQL. I hope to have proper code for that up in the stevecj/farel project soon.

@sfsekaran
Copy link

That would be really useful. I look forward to it :)

@rafaelfranca
Copy link
Member

Pull request are welcome, if you wan to discuss this feature more send an email to the Rails Core mailing list.

Closing since it is a feature request and we don't take feature requests in the issues tracker.

@jaredbeck
Copy link

There's a matches_regexp method now (

def matches_regexp other, case_sensitive = true
).

@nimmolo
Copy link

nimmolo commented Sep 18, 2023

lol "Arel is a private API" is Rails-speak for "We don't feel like documenting this, and then having to answer a flood of questions. But just between you and me, it's the only way to write a portable query"...

Thank you @jaredbeck. The amount of time i've wasted trying to track down documentation of Arel methods and forgetting to just read the class Predications! 🤌 che palle

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

No branches or pull requests

6 participants