X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FBasicSupport.java;h=ded09c2234ba9cf50f8db06cdfa6f72280539e07;hp=74f11156e82c265a0eee1ddbd09b7c417a98ed12;hb=d011400048cae6884f0d94c320498429b45fb48a;hpb=3727aae2b0516c5ed5366cde29544565f1d6c6b0 diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 74f1115..ded09c2 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -653,7 +653,9 @@ public abstract class BasicSupport { * @param in * the input * @param needle - * a string that must be found inside the target line + * a string that must be found inside the target line (also + * supports "^" at start to say "only if it starts with" the + * needle) * @param relativeLine * the line to return based upon the target line position (-1 = * the line before, 0 = the target line...) @@ -675,7 +677,9 @@ public abstract class BasicSupport { * @param in * the input * @param needle - * a string that must be found inside the target line + * a string that must be found inside the target line (also + * supports "^" at start to say "only if it starts with" the + * needle) * @param relativeLine * the line to return based upon the target line position (-1 = * the line before, 0 = the target line...) @@ -697,8 +701,18 @@ public abstract class BasicSupport { while (scan.hasNext()) { lines.add(scan.next()); - if (index == -1 && lines.get(lines.size() - 1).contains(needle)) { - index = lines.size() - 1; + if (index == -1) { + if (needle.startsWith("^")) { + if (lines.get(lines.size() - 1).startsWith( + needle.substring(1))) { + index = lines.size() - 1; + } + + } else { + if (lines.get(lines.size() - 1).contains(needle)) { + index = lines.size() - 1; + } + } } if (index >= 0 && index + relativeLine < lines.size()) {