Answer the question
In order to leave comments, you need to log in
How can one replace attributes in path using (or not) regex?
To be more precise:
There is a large list of uris in the table (as patterns for defining some rules).
For example, "...localhost:8080/students/{studentId}/grades/{maths}"
I catch requests through the filter, pull out uri, I can get all these attributes by their names.
Now I need to take a string (this uri) and replace these attributes (values) in it with their names: that is, 1234 with "{studentId}" to compare with the patterns from the table.
What is the difficulty: I can’t just search for substring, because such a combination of characters can be found not only among the attributes, but also in the uri endpoints themselves - then I will replace the wrong one (such as students / {students}). Or this combination can be inside another (it is impossible to limit the search condition to the presence of slashes, because the attribute can be at the end of uri.
How can you replace attributes with their names in a string, given all these options? Are there such regexes?
I will be very grateful for your help
Answer the question
In order to leave comments, you need to log in
Hello!
I think that the whole picture of the current situation is better known to you than to me. But!
Or this combination can be inside another (it is impossible to limit the search condition to the presence of slashes, because the attribute can be at the end of uri.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question