in reply to Regex partial/leading match
The issue we have here is that your problem is not very well defined, so that it is difficult to suggest a solution.
If I understand your issue correctly, you are not mastering the regexes that you are going to use, they are provided to you by an external source. If such is the case, then you can't do very much about it, it is the author of these regex that ought to provide you with the proper set of patterns.
Well, a general solution to this problem is probably out of reach, but I am also not saying that it can't be done. In theory at least, you might be able to parse the patterns supplied to you to build beginning-of-string regex sub-patterns provided those patterns supplied to you are relatively simple and very well defined, but that is not very easy and probably not a very robust solution, because you're probably bound to fail if the author of the patterns provided to you decides to start to be a bit too clever. OTOH, if you can define a very limited subset of authorized patterns, then it can probably be done. The fact that you seem to be willing to analyze directory paths is certainly essential to a possible definition of such simple patterns provided to you and therefore to a possible solution to your problem.
But you don't give us enough information for us to really be able to help you much further.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex partial/leading match
by Anonymous Monk on Jan 02, 2016 at 13:14 UTC |