How to use a regex to search backwards effectively?

后端 未结 5 962
温柔的废话
温柔的废话 2020-12-18 22:51

I\'m searching forward in an array of strings with a regex, like this:

for (int j = line; j < lines.length; j++) {  
    if (lines[j] == null || lines[j].         


        
5条回答
  •  我在风中等你
    2020-12-18 23:09

    If a previous match is something, that you have already matched going forward, then what about creating a list of matched positions while searching forward and then just use it to jump back instead of searching backward?

提交回复
热议问题