Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #2228
Closed
Open
Issue created Jul 26, 2022 by Administrator@rootContributor

Improve filter regex

Created by: rostixman

What would you like to be able to do? Can you provide some examples?

I would like to be able to pass filter attribute in French, German, or other languages. Because now regex doesn't allow non-Latin characters.

In my case I have Mobility gem and want to search in other languages. I found solution with custom search method, but in my case it's enough to add this:

COLLECTION_FILTERS = {
    name: -> (resources, attr) { resources.search(attr) }
  }.freeze

and also I add search method to resource model with the logic that I need:

scope :search, -> (name_q) do
    i18n do
      name.lower.matches("%#{name_q&.downcase}%")
    end
  end

How could we go about implementing that? Switch \w to Unicode codes/ranges or word.match?(/^#{filter}:.*$/) but this way may be unsafe

Can you think of other approaches to the problem? Allow custom regex for filter attribute

Assignee
Assign to
Time tracking