Class PatternConsts


  • public final class PatternConsts
    extends java.lang.Object
    Constant patterns, used in different other classes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CHECK_CUSTOM_PATTERN_DEFAULT
      Tag Validation Option: check user defined tags according to regexp.
      static java.util.regex.Pattern DICTIONARY_ZIP
      Pattern for detecting remote dictionary file archives
      static java.util.regex.Pattern EQUIV_TEXT_ATTRIBUTE_DECOMPILE
      Pattern that matches an equiv-text attribute as used in XLIFF inline codes.
      static java.util.regex.Pattern HTML_BR
      Pattern for detecting html <BR> tags
      static java.util.regex.Pattern HTML_ENCODING
      compiled pattern to extract the encoding from HTML file, if any
      static java.util.regex.Pattern HTML_HEAD
      Compiled pattern to look for HTML file HEAD declaration.
      static java.util.regex.Pattern HTML_HTML
      compiled pattern to look for HTML file HTML declaration
      static java.util.regex.Pattern HTML5_ENCODING
      compiled pattern to extract the encoding from HTML5 file, if any
      static java.util.regex.Pattern LANG_AND_COUNTRY
      Pattern that detects language and country, with an optionnal script in the middle.
      static java.util.regex.Pattern LINE_ENDING
      compiled pattern to match line ending win/mac/linux
      static java.util.regex.Pattern OMEGAT_TAG
      Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string).
      static java.util.regex.Pattern OMEGAT_TAG_DECOMPILE
      Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) and decompiles them into pieces: leading /, if any tag shortcut tag number trailing /, if any Call matcher.group(n) to get each piece.
      static java.util.regex.Pattern OMEGAT_TAG_ONLY
      Pattern that matches full string containing in full and only omegat-specific tag (without leading < and trailing >).
      static java.util.regex.Pattern OMEGAT_TAG_SPACE
      Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) plus a space after it.
      static java.util.regex.Pattern PRINTF_VARS
      Pattern for detecting the placeholders in a printf-function string which can occur in languages like php, C and others.
      static java.util.regex.Pattern PROTECTED_PARTS_PAIRED_TAG_DECOMPILE
      Pattern that matches paired tag in protected parts opening tag text between tags closing tag Call matcher.group(n) to get each piece.
      static java.util.regex.Pattern REGEX_VARIABLE
      Pattern for regular expression variable : $n, where n is a number, but should not be preceded by backslash
      static java.util.regex.Pattern SIMPLE_JAVA_MESSAGEFORMAT_PATTERN_VARS  
      static java.util.regex.Pattern SIMPLE_PLACEHOLDERS
      Pattern for detecting OmegaT-tags and other placeholders (extended sprintf-variant) in texts
      static java.util.regex.Pattern SIMPLE_PRINTF_VARS
      Pattern for detecting the placeholders in a printf-function string.
      static java.util.regex.Pattern SPACE_OMEGAT_TAG
      Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) with a space before it.
      static java.util.regex.Pattern SPACE_TAB  
      static java.util.regex.Pattern SPACY_REGEX
      Pattern that detects space-only regular expressions.
      static java.util.regex.Pattern XML_DOCTYPE
      Compiled pattern to extract the DOCTYPE declaration from XML file, if any.
      static java.util.regex.Pattern XML_ENCODING
      Compiled pattern to extract the encoding from XML file, if any.
      static java.util.regex.Pattern XML_HEADER
      compiled pattern to match XML header
      static java.util.regex.Pattern XML_ROOTTAG
      Compiled pattern to extract the root tag from XML file, if any.
      static java.util.regex.Pattern XML_XMLNS
      Compiled pattern to extract the xlmns declaration from an XML file, if any.
    • Field Detail

      • CHECK_CUSTOM_PATTERN_DEFAULT

        public static final java.lang.String CHECK_CUSTOM_PATTERN_DEFAULT
        Tag Validation Option: check user defined tags according to regexp.
        See Also:
        Constant Field Values
      • XML_ENCODING

        public static final java.util.regex.Pattern XML_ENCODING
        Compiled pattern to extract the encoding from XML file, if any. Found encoding is stored in group #1.
      • XML_HEADER

        public static final java.util.regex.Pattern XML_HEADER
        compiled pattern to match XML header
      • XML_DOCTYPE

        public static final java.util.regex.Pattern XML_DOCTYPE
        Compiled pattern to extract the DOCTYPE declaration from XML file, if any. Groups:
        #1 - DOCTYPE name
        #3 - PUBLIC DOCTYPE URL
        #5 - SYSTEM DOCTYPE URL
      • XML_ROOTTAG

        public static final java.util.regex.Pattern XML_ROOTTAG
        Compiled pattern to extract the root tag from XML file, if any. Group #1 should contain the root tag.
      • XML_XMLNS

        public static final java.util.regex.Pattern XML_XMLNS
        Compiled pattern to extract the xlmns declaration from an XML file, if any. Group #2 should contain the xmlns declaration. E.g., http://www.w3.org/2001/XMLSchema-instance
      • HTML_ENCODING

        public static final java.util.regex.Pattern HTML_ENCODING
        compiled pattern to extract the encoding from HTML file, if any
      • HTML5_ENCODING

        public static final java.util.regex.Pattern HTML5_ENCODING
        compiled pattern to extract the encoding from HTML5 file, if any
      • HTML_HEAD

        public static final java.util.regex.Pattern HTML_HEAD
        Compiled pattern to look for HTML file HEAD declaration. Using [^e] instead of . prevents confusing <head> with <header> from HTML 5
      • HTML_HTML

        public static final java.util.regex.Pattern HTML_HTML
        compiled pattern to look for HTML file HTML declaration
      • HTML_BR

        public static final java.util.regex.Pattern HTML_BR
        Pattern for detecting html <BR> tags
      • OMEGAT_TAG_ONLY

        public static final java.util.regex.Pattern OMEGAT_TAG_ONLY
        Pattern that matches full string containing in full and only omegat-specific tag (without leading < and trailing >).
      • OMEGAT_TAG

        public static final java.util.regex.Pattern OMEGAT_TAG
        Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string).
      • OMEGAT_TAG_SPACE

        public static final java.util.regex.Pattern OMEGAT_TAG_SPACE
        Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) plus a space after it.
      • SPACE_OMEGAT_TAG

        public static final java.util.regex.Pattern SPACE_OMEGAT_TAG
        Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) with a space before it.
      • OMEGAT_TAG_DECOMPILE

        public static final java.util.regex.Pattern OMEGAT_TAG_DECOMPILE
        Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) and decompiles them into pieces:
        1. leading /, if any
        2. tag shortcut
        3. tag number
        4. trailing /, if any
        Call matcher.group(n) to get each piece.
      • PROTECTED_PARTS_PAIRED_TAG_DECOMPILE

        public static final java.util.regex.Pattern PROTECTED_PARTS_PAIRED_TAG_DECOMPILE
        Pattern that matches paired tag in protected parts
        1. opening tag
        2. text between tags
        3. closing tag
        Call matcher.group(n) to get each piece.
      • EQUIV_TEXT_ATTRIBUTE_DECOMPILE

        public static final java.util.regex.Pattern EQUIV_TEXT_ATTRIBUTE_DECOMPILE
        Pattern that matches an equiv-text attribute as used in XLIFF inline codes.
      • SPACY_REGEX

        public static final java.util.regex.Pattern SPACY_REGEX
        Pattern that detects space-only regular expressions.
      • LANG_AND_COUNTRY

        public static final java.util.regex.Pattern LANG_AND_COUNTRY
        Pattern that detects language and country, with an optionnal script in the middle.
      • DICTIONARY_ZIP

        public static final java.util.regex.Pattern DICTIONARY_ZIP
        Pattern for detecting remote dictionary file archives
      • SPACE_TAB

        public static final java.util.regex.Pattern SPACE_TAB
      • REGEX_VARIABLE

        public static final java.util.regex.Pattern REGEX_VARIABLE
        Pattern for regular expression variable : $n, where n is a number, but should not be preceded by backslash
      • LINE_ENDING

        public static final java.util.regex.Pattern LINE_ENDING
        compiled pattern to match line ending win/mac/linux
      • PRINTF_VARS

        public static final java.util.regex.Pattern PRINTF_VARS
        Pattern for detecting the placeholders in a printf-function string which can occur in languages like php, C and others. placeholder ::= "%" [ARGUMENTSWAPSPECIFIER] [SIGNSPECIFIER] [PADDINGSPECIFIER] [ALIGNMENTSPECIFIER] [WIDTHSPECIFIER] [PRECISIONSPECIFIER] TYPESPECIFIER NUMBER ::= { "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" } ARGUMENTSWAPSPECIFIER = NUMBER "$" SIGNSPECIFIER ::= "+" | "-" PADDINGSPECIFIER ::= " " | "0" | "'" CHARACTER ALIGNMENTSPECIFIER ::= "" | "-" WIDTHSPECIFIER ::= NUMBER PRECISIONSPECIFIER ::= "." NUMBER TYPESPECIFIER ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "i" | "n" | "o" | "p" | "s" | "u" | "x" | "X" | "%" //c++: [cdieEfgGosuxXpn%] //php: [bcdeufFosxX%] NB: Because having space as paddingspecifier leads to many false matches in regular text, and space being the default padding specifier in php, and being able to have space or 0 as padding specifier by prefixing it with ', and having the padding specifier not being used frequently in most cases, the regular expression only corresponds with quote+paddingspecifier. NB2: The argument swap specifier gives explicit ordering of variables, without it, the ordering is implicit (first in sequence is first in order) Example in code: echo printf(gettext("%s is very %s"), "OmegaT", "great");
      • SIMPLE_PRINTF_VARS

        public static final java.util.regex.Pattern SIMPLE_PRINTF_VARS
        Pattern for detecting the placeholders in a printf-function string. It detects only simple placeholders, without SIGN-, PADDING-, ALIGNMENT- and WIDTH specifier.
        See Also:
        PRINTF_VARS
      • SIMPLE_JAVA_MESSAGEFORMAT_PATTERN_VARS

        public static final java.util.regex.Pattern SIMPLE_JAVA_MESSAGEFORMAT_PATTERN_VARS
      • SIMPLE_PLACEHOLDERS

        public static final java.util.regex.Pattern SIMPLE_PLACEHOLDERS
        Pattern for detecting OmegaT-tags and other placeholders (extended sprintf-variant) in texts
    • Method Detail

      • getPlaceholderPattern

        public static java.util.regex.Pattern getPlaceholderPattern()
        Returns the placeholder pattern (OmegaT tags, printf tags, java MessageFomat tags, custom tags, combined according to user configuration)
        Returns:
        the pattern
        See Also:
        updatePlaceholderPattern()
      • updatePlaceholderPattern

        public static void updatePlaceholderPattern()
        Resets the placeholder pattern. Use it when the user has changed tagvalidation configuration.
      • getRemovePattern

        public static java.util.regex.Pattern getRemovePattern()
      • updateRemovePattern

        public static void updateRemovePattern()
        Resets the remove pattern. Use it when the user has changed tagvalidation configuration.
      • getCustomTagPattern

        public static java.util.regex.Pattern getCustomTagPattern()
      • updateCustomTagPattern

        public static void updateCustomTagPattern()
        Resets the remove pattern. Use it when the user has changed tagvalidation configuration.