void initSearchUnicodeAscii()
    {
        StringBuilder regex = new StringBuilder("\\Q");  // everything-quoted regular expression

        if (literal.length() * 2 > MAX_SEQUENCE_SIZE)  // 16 bit Unicode chars
            literal = literal.subSequence(0, MAX_SEQUENCE_SIZE / 2);
        literalByteLength = literal.length() * 2;

        boolean isAsciiCompatible = true;
        byte[] tmpBytes = new byte[literal.length()];
        char previous = '\0';
        for (int i = 0; i < literal.length(); ++i) {
            char aChar = literal.charAt(i);
            regex.append(aChar);

            if (previous == '\\' && aChar == 'E')
                regex.append("\\\\E\\Q");

            previous = aChar;

            tmpBytes[i] = (byte) aChar;
            if (aChar > 255) isAsciiCompatible = false;
        }
        regex.append("\\E");

        int ignoreCaseFlags = 0;
        if (!caseSensitive) ignoreCaseFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
        pattern = Pattern.compile(regex.toString(), ignoreCaseFlags);

        if (isAsciiCompatible)
            byteFindSequence = tmpBytes;
    }
Get the current location being searched in the content. Approximate value.

@return position in the content
plugins/org.jkiss.dbeaver.ui.editors.hex/src/org/jkiss/dbeaver/ui/editors/binary/BinaryTextFinder.java