Package org.apache.tools.ant.util.regexp
Class RegexpUtil
java.lang.Object
org.apache.tools.ant.util.regexp.RegexpUtil
Regular expression utilities class which handles flag operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
asOptions
(boolean caseSensitive) Convert flag to regex options.static int
asOptions
(boolean caseSensitive, boolean multiLine, boolean singleLine) Convert flags to regex options.static int
convert regex option flag characters to regex options gRegexp.REPLACE_ALL iRegexpMatcher.MATCH_CASE_INSENSITIVE mRegexpMatcher.MATCH_MULTILINE sRegexpMatcher.MATCH_SINGLELINEstatic boolean
hasFlag
(int options, int flag) Check the options has a particular flag set.static int
removeFlag
(int options, int flag) Remove a particular flag from an int value contains the option flags.
-
Constructor Details
-
RegexpUtil
public RegexpUtil()
-
-
Method Details
-
hasFlag
public static boolean hasFlag(int options, int flag) Check the options has a particular flag set.- Parameters:
options
- anint
valueflag
- anint
value- Returns:
- true if the flag is set
-
removeFlag
public static int removeFlag(int options, int flag) Remove a particular flag from an int value contains the option flags.- Parameters:
options
- anint
valueflag
- anint
value- Returns:
- the options with the flag unset
-
asOptions
convert regex option flag characters to regex options- g
- Regexp.REPLACE_ALL
- i
- RegexpMatcher.MATCH_CASE_INSENSITIVE
- m
- RegexpMatcher.MATCH_MULTILINE
- s
- RegexpMatcher.MATCH_SINGLELINE
- Parameters:
flags
- the string containing the flags- Returns:
- the Regexp option bits
- Since:
- Ant 1.8.2
-
asOptions
public static int asOptions(boolean caseSensitive) Convert flag to regex options.- Parameters:
caseSensitive
- opposite of RegexpMatcher.MATCH_CASE_INSENSITIVE- Returns:
- the Regexp option bits
- Since:
- Ant 1.8.2
-
asOptions
public static int asOptions(boolean caseSensitive, boolean multiLine, boolean singleLine) Convert flags to regex options.- Parameters:
caseSensitive
- opposite of RegexpMatcher.MATCH_CASE_INSENSITIVEmultiLine
- RegexpMatcher.MATCH_MULTILINEsingleLine
- RegexpMatcher.MATCH_SINGLELINE- Returns:
- the Regexp option bits
- Since:
- Ant 1.8.2
-