本文整理汇总了Java中org.apache.oro.text.perl.Perl5Util.group方法的典型用法代码示例。如果您正苦于以下问题:Java Perl5Util.group方法的具体用法?Java Perl5Util.group怎么用?Java Perl5Util.group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oro.text.perl.Perl5Util
的用法示例。
在下文中一共展示了Perl5Util.group方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidAuthorityHostNoDot
import org.apache.oro.text.perl.Perl5Util; //导入方法依赖的package包/类
/**
* Check if the authority contains a valid hostname without "."
* characters and an optional port number
*
* @param authority
* @return <code>true</code> if the authority is valid
*/
private boolean isValidAuthorityHostNoDot(String authority) {
Perl5Util authorityMatcher = new Perl5Util();
if (authority != null
&& authorityMatcher.match(
"/^([a-zA-Z\\d\\-\\.]*)(:\\d*)?(.*)?/", authority)) {
String hostIP = authorityMatcher.group(1);
if (hostIP.indexOf('.') < 0) {
// the hostname contains no dot, add domain validation to check invalid hostname like "g08fnstd110825-"
DomainValidator domainValidator = DomainValidator.getInstance(true);
if(!domainValidator.isValid(hostIP)) {
return false;
}
String port = authorityMatcher.group(2);
if (!isValidPort(port)) {
return false;
}
String extra = authorityMatcher.group(3);
return GenericValidator.isBlankOrNull(extra);
} else {
return false;
}
} else {
return false;
}
}
示例2: addTextLinks
import org.apache.oro.text.perl.Perl5Util; //导入方法依赖的package包/类
private void addTextLinks(List<Link> links, TextDocumentDomainObject textDocument, HttpServletRequest request) {
Map<Integer, TextDomainObject> texts = textDocument.getTexts();
for (Map.Entry<Integer, TextDomainObject> entry : texts.entrySet()) {
Integer textIndex = entry.getKey();
TextDomainObject text = entry.getValue();
String textString = text.getText();
Perl5Util perl5Util = new Perl5Util();
PatternMatcherInput patternMatcherInput = new PatternMatcherInput(textString);
while (matchesUrl(perl5Util, patternMatcherInput)) {
String url = perl5Util.group(1);
if (null == url) {
url = perl5Util.group(0);
}
Link link = new TextLink(textDocument, textIndex, url, request);
links.add(link);
}
}
}
示例3: isValidAuthorityHostNoTld
import org.apache.oro.text.perl.Perl5Util; //导入方法依赖的package包/类
/**
* Check if the authority contains a hostname without top level domain
* and an optional port number
*
* @param authority
* @return <code>true</code> if the authority is valid
*/
private boolean isValidAuthorityHostNoTld(String authority) {
Perl5Util authorityMatcher = new Perl5Util();
if (authority != null
&& authorityMatcher.match(
"/^([a-zA-Z\\d\\-\\.]*)(:\\d*)?(.*)?/", authority)) {
String host = authorityMatcher.group(1);
if (host.indexOf('.') > 0) {
DomainValidator domainValidator = DomainValidator.getInstance();
// Make the host have a valid TLD, so that the "no TLD" host can pass the domain validation.
String patchedHost = host + ".com";
if(!domainValidator.isValid(patchedHost)) {
return false;
}
String port = authorityMatcher.group(2);
if (!isValidPort(port)) {
return false;
}
String extra = authorityMatcher.group(3);
return GenericValidator.isBlankOrNull(extra);
} else {
return false;
}
} else {
return false;
}
}
示例4: accept
import org.apache.oro.text.perl.Perl5Util; //导入方法依赖的package包/类
public boolean accept(File file) {
String filename = file.getName();
Perl5Util perl5Util = new Perl5Util();
if (perl5Util.match("/(?:(\\d+)(?:_(\\d+))?)(?:_se|\\.(.*))?/", filename)) {
String idStr = perl5Util.group(1);
String variantName = FileUtility.unescapeFilename(StringUtils.defaultString(perl5Util.group(3)));
String docVersionNo = perl5Util.group(2);
return accept(file,
Integer.parseInt(idStr),
docVersionNo == null ? 0 : Integer.parseInt(docVersionNo),
variantName);
}
return false;
}