Package org.omegat.util
Class PatternConsts
java.lang.Object
org.omegat.util.PatternConsts
Constant patterns, used in different other classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTag Validation Option: check user defined tags according to regexp.static final PatternPattern for detecting remote dictionary file archivesstatic final PatternPattern that matches an equiv-text attribute as used in XLIFF inline codes.static final PatternPattern for detecting html <BR> tagsstatic final Patterncompiled pattern to extract the encoding from HTML file, if anystatic final PatternCompiled pattern to look for HTML file HEAD declaration.static final Patterncompiled pattern to look for HTML file HTML declarationstatic final Patterncompiled pattern to extract the encoding from HTML5 file, if anystatic final PatternPattern that detects language and country, with an optionnal script in the middle.static final Patterncompiled pattern to match line ending win/mac/linuxstatic final PatternPattern that matches omegat-specific tags (with leading < and trailing > in any place of a string).static final PatternPattern 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 Callmatcher.group(n)to get each piece.static final PatternPattern that matches full string containing in full and only omegat-specific tag (without leading < and trailing >).static final PatternPattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) plus a space after it.static final PatternPattern for detecting the placeholders in a printf-function string which can occur in languages like php, C and others.static final PatternPattern that matches paired tag in protected parts opening tag text between tags closing tag Callmatcher.group(n)to get each piece.static final PatternPattern for regular expression variable : $n, where n is a number, but should not be preceded by backslashstatic final Patternstatic final PatternPattern for detecting OmegaT-tags and other placeholders (extended sprintf-variant) in textsstatic final PatternPattern for detecting the placeholders in a printf-function string.static final PatternPattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) with a space before it.static final Patternstatic final PatternPattern that detects space-only regular expressions.static final PatternCompiled pattern to extract the DOCTYPE declaration from XML file, if any.static final PatternCompiled pattern to extract the encoding from XML file, if any.static final Patterncompiled pattern to match XML headerstatic final PatternCompiled pattern to extract the root tag from XML file, if any.static final PatternCompiled pattern to extract the xlmns declaration from an XML file, if any. -
Method Summary
Modifier and TypeMethodDescriptionstatic Patternstatic PatternReturns the placeholder pattern (OmegaT tags, printf tags, java MessageFomat tags, custom tags, combined according to user configuration)static Patternstatic voidResets the remove pattern.static voidResets the placeholder pattern.static voidResets the remove pattern.
-
Field Details
-
CHECK_CUSTOM_PATTERN_DEFAULT
Tag Validation Option: check user defined tags according to regexp.- See Also:
-
XML_ENCODING
Compiled pattern to extract the encoding from XML file, if any. Found encoding is stored in group #1. -
XML_HEADER
compiled pattern to match XML header -
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
Compiled pattern to extract the root tag from XML file, if any. Group #1 should contain the root tag. -
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
compiled pattern to extract the encoding from HTML file, if any -
HTML5_ENCODING
compiled pattern to extract the encoding from HTML5 file, if any -
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
compiled pattern to look for HTML file HTML declaration -
HTML_BR
Pattern for detecting html <BR> tags -
OMEGAT_TAG_ONLY
Pattern that matches full string containing in full and only omegat-specific tag (without leading < and trailing >). -
OMEGAT_TAG
Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string). -
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
Pattern that matches omegat-specific tags (with leading < and trailing > in any place of a string) with a space before it. -
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
matcher.group(n)to get each piece. -
PROTECTED_PARTS_PAIRED_TAG_DECOMPILE
Pattern that matches paired tag in protected parts- opening tag
- text between tags
- closing tag
matcher.group(n)to get each piece. -
EQUIV_TEXT_ATTRIBUTE_DECOMPILE
Pattern that matches an equiv-text attribute as used in XLIFF inline codes. -
SPACY_REGEX
Pattern that detects space-only regular expressions. -
LANG_AND_COUNTRY
Pattern that detects language and country, with an optionnal script in the middle. -
DICTIONARY_ZIP
Pattern for detecting remote dictionary file archives -
SPACE_TAB
-
REGEX_VARIABLE
Pattern for regular expression variable : $n, where n is a number, but should not be preceded by backslash -
LINE_ENDING
compiled pattern to match line ending win/mac/linux -
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
Pattern for detecting the placeholders in a printf-function string. It detects only simple placeholders, without SIGN-, PADDING-, ALIGNMENT- and WIDTH specifier.- See Also:
-
SIMPLE_JAVA_MESSAGEFORMAT_PATTERN_VARS
-
SIMPLE_PLACEHOLDERS
Pattern for detecting OmegaT-tags and other placeholders (extended sprintf-variant) in texts
-
-
Method Details
-
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
public static void updatePlaceholderPattern()Resets the placeholder pattern. Use it when the user has changed tagvalidation configuration. -
getRemovePattern
-
updateRemovePattern
public static void updateRemovePattern()Resets the remove pattern. Use it when the user has changed tagvalidation configuration. -
getCustomTagPattern
-
updateCustomTagPattern
public static void updateCustomTagPattern()Resets the remove pattern. Use it when the user has changed tagvalidation configuration.
-