There is some semblance of the path to some object:

/ folder40053 / fileparent4413 / file /

and similar "folder40053" can be many. How to use regular expressions on python to more efficiently process queries for type searches

/ folder4 * / fileparent * / file

to get what is on the way in the request, while taking into account which side is the asterisk?

  • one
    Do you have a list of strings and you need to select some of them by a pattern, for example, a regular schedule? - gil9red
  • Yes, the problem is that at the input we get an expression of the type "word *", and depending on the location of the star itself, we should look for a match. - Eugene
  • The expression /folder4*/fileparent*/file on a regular /folder4.*/fileparent.*/file would be: /folder4.*/fileparent.*/file - gil9red
  • running along the line and replacing the asterisks with dots looks a bit like a crutch, I think - Eugene
  • one
    Well, you talked about regulars. I gave you an example of the regular season. And what you have in question is a wildcard: docs.python.org/3.6/library/fnmatch.html - gil9red

0