A DSL for text matching

I am developing an application that consumes bank transaction information. One feature allows the user to identify payees by matching/searching for text in one of the transaction fields.

For example given:

  • Card transaction of 20.00 MXN issued by Amazon Prime Val CIUDAD DE MEX
  • Card transaction of 7,397.98 MXN issued by Amazon Mx CIUDAD DE MEX

The user sholu be able to say ‘if contains Amazon’, so both transactions would be identified as if coming from the same payee.
Other option would be ‘starts with’, ‘ends with’, and others.

Does anyone know of a DSL that con be used for this or give me any pointers on how to design such a DSL?

Must Google searches point me to
Elasticsearch Query and Query DSL, but they seam an overkill.

Probably the user won’t type the dsl but rather use dropdowns and and/or/not buttons to build the search.

Thanks!

2 Likes

I am not sure whether it makes sense to use a DSL to create this DSL. From your description, it appears to be essentially a user friendly interface for regular expressions/searches. I do not see programs consist of many instructions. So, most tools would probably be overkill to define a language like the one you described.

You might find inspiration looking at Gherkin, a DSL to describe test scenarios. They use berp to create the parser. Then they implement the language walking and interpreting the tree. This should work for your language, too.