WORK AROUND
Get a subsequence and search on that. The drawbacks of this workaround is that you might have to copy the data to make the subsequence, and then the indexes have to be shifted back to the original sequence indexes. So this workaround could potentially be inconvenient, error-prone, and hurt performance.
Another alternative is to do the search and reject a match if it occurs beyond the index you want. The drawback of this workaround is performance related; the search may go a long ways beyond where you want and it might take a long time doing it in a large sequence. In certain rare cases the regex may even need more resources than are available if it is allowed to search through the whole sequence when it might complete on a smaller one.
|