eclipse plugin: escape regex specific characters (if any)
This commit is contained in:
parent
4e0b513143
commit
982fd5dcc8
1 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ import java.util.regex.Pattern;
|
|||
public class StringUtils {
|
||||
public static boolean startsWith(String target, String sequence)
|
||||
{
|
||||
Pattern pattern = Pattern.compile("[\t| ]*"+sequence);
|
||||
Pattern pattern = Pattern.compile("[\t| ]*\\"+sequence);
|
||||
Matcher matcher = pattern.matcher(target);
|
||||
return (matcher.find() && matcher.start() == 0);
|
||||
}
|
||||
|
@ -90,4 +90,4 @@ public class StringUtils {
|
|||
}
|
||||
return resString.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue