java.lang.Object
org.gjt.sp.jedit.search.SearchMatcher
org.gjt.sp.jedit.search.PatternSearchMatcher
A regular expression string matcher using java.util.regex.
- Since:
- jEdit 4.3pre5
- Version:
- $Id: PatternSearchMatcher.java 25301 2020-05-01 16:38:04Z kpouer $
- Author:
- Marcelo Vanzin
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.gjt.sp.jedit.search.SearchMatcher
SearchMatcher.Match
-
Field Summary
Fields inherited from class org.gjt.sp.jedit.search.SearchMatcher
noWordSep, returnValue, wholeWord
-
Constructor Summary
ConstructorDescriptionPatternSearchMatcher
(String search, boolean ignoreCase) Creates a new regular expression string matcher.PatternSearchMatcher
(Pattern re, boolean ignoreCase) Creates a new regular expression already compiled.PatternSearchMatcher
(Pattern re, boolean ignoreCase, boolean wholeWord) Creates a new regular expression string matcher. -
Method Summary
Modifier and TypeMethodDescriptionnextMatch
(CharSequence text, boolean start, boolean end, boolean firstTime, boolean reverse) Returns the offset of the first match of the specified text within this matcher.static Pattern
removeNonCapturingGroups
(Pattern re, int flags) toString()
Methods inherited from class org.gjt.sp.jedit.search.SearchMatcher
isWholeWord, setNoWordSep
-
Constructor Details
-
PatternSearchMatcher
Creates a new regular expression string matcher.- Parameters:
search
- the search patternignoreCase
-true
if you want to ignore case- Since:
- jEdit 4.3pre5
- See Also:
-
PatternSearchMatcher
Creates a new regular expression string matcher.- Parameters:
re
- the compiled regexignoreCase
-true
if you want to ignore casewholeWord
-true
to search for whole word only- Since:
- jEdit 4.5pre1
- See Also:
-
PatternSearchMatcher
Creates a new regular expression already compiled.- Parameters:
re
- the compiled regexignoreCase
-true
if you want to ignore case- Since:
- jEdit 4.3pre13
- See Also:
-
-
Method Details
-
nextMatch
public SearchMatcher.Match nextMatch(CharSequence text, boolean start, boolean end, boolean firstTime, boolean reverse) Returns the offset of the first match of the specified text within this matcher.Reverse regex search is done by searching from the beginning to just prior to the current match, so will be inefficient for large buffers.
- Specified by:
nextMatch
in classSearchMatcher
- Parameters:
text
- The text to search instart
- True if the start of the text is the beginning of a lineend
- True if the end of the text is the end of a linefirstTime
- If false and the search string matched at the start offset with length zero, automatically find next matchreverse
- If true, searching will be performed in a backward direction.- Returns:
- A
SearchMatcher.Match
object.
-
removeNonCapturingGroups
-
toString
-