How to sort on a postgres regex?
I'm trying to extract a number from a text field using regex and sort on it.
Perhaps using calculations:
I can't figure out the syntax.
Thank you!
2 Replies
A calculation should work. In the first code snippet, you probably need to import expr or do Ash.Query.expr and the fragment is from the AshPostgres Datalayer. Not sure which module from the top of my head. I haven't used sort that way though so not sure if it works, but I did something similar with calculations
Update:
works.