java.util.regex.Matcher.regionStart()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中java.util.regex.Matcher.regionStart()方法的一些代码示例,展示了Matcher.regionStart()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher.regionStart()方法的具体详情如下:
包路径:java.util.regex.Matcher
类名称:Matcher
方法名:regionStart

Matcher.regionStart介绍

[英]Holds the start of the region, or 0 if the matching should start at the beginning of the text.
[中]保留区域的开头,如果匹配应该从文本的开头开始,则保留0。

代码示例

代码示例来源:origin: cSploit/android

public static Author fromString(String nameAndEmail) {
  Matcher matcher = EMAIL.matcher(nameAndEmail);
  String name, email;

  if(!matcher.find()) {
   name = nameAndEmail.trim();
   email = null;
  } else {
   name = nameAndEmail.substring(0, matcher.regionStart());
   email = matcher.group(1).replace(" [at] ", "@");
  }

  return new Author(name, email);
 }
}

代码示例来源:origin: nutzam/nutz

/**
 * 显示 Matcher 的详细信息
 * 
 * @param m
 *            Matcher 对象,必须执行过 find
 * @return 信息
 */
public static String matcherFound(Matcher m) {
  StringBuilder sb = new StringBuilder();
  sb.append(String.format("%d/%d  Regin:%d/%d\n",
              m.start(),
              m.end(),
              m.regionStart(),
              m.regionEnd()));
  for (int i = 0; i <= m.groupCount(); i++)
    sb.append(String.format("%2d:[%3d,%3d) %s\n", i, m.start(i), m.end(i), m.group(i)));
  return sb.toString();
}

代码示例来源:origin: robovm/robovm

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: ltsopensource/light-task-scheduler

if (!patternMatcher.lookingAt()) {
  throw new IllegalArgumentException(
      "Illegal pattern character '" + pattern.charAt(patternMatcher.regionStart()) + "'");
  currentStrategy = nextStrategy;
if (patternMatcher.regionStart() != patternMatcher.regionEnd()) {
  throw new IllegalArgumentException("Failed to parse \"" + pattern + "\" ; gave up at index " + patternMatcher.regionStart());

代码示例来源:origin: ltsopensource/light-task-scheduler

if (!patternMatcher.lookingAt()) {
  throw new IllegalArgumentException(
      "Illegal pattern character '" + pattern.charAt(patternMatcher.regionStart()) + "'");
  currentStrategy = nextStrategy;
if (patternMatcher.regionStart() != patternMatcher.regionEnd()) {
  throw new IllegalArgumentException("Failed to parse \"" + pattern + "\" ; gave up at index " + patternMatcher.regionStart());

代码示例来源:origin: com.google.protobuf/protobuf-java

while (pos < matcher.regionStart()) {
 if (text.charAt(pos) == '\n') {
  ++line;
if (matcher.regionStart() == matcher.regionEnd()) {

代码示例来源:origin: osmandapp/Osmand

while (pos < matcher.regionStart()) {
 if (text.charAt(pos) == '\n') {
  ++line;
if (matcher.regionStart() == matcher.regionEnd()) {

代码示例来源:origin: jphp-group/jphp

@FastMethod
@Signature
public Memory regionStart(Environment env, Memory... args) {
  return LongMemory.valueOf(matcher.regionStart());
}

代码示例来源:origin: aragozin/jvm-tools

throw error(matcher.regionStart(), "cannot parse");

代码示例来源:origin: palantir/atlasdb

while (pos < matcher.regionStart()) {
  if (text.charAt(pos) == '\n') {
    ++line;
if (matcher.regionStart() == matcher.regionEnd()) {

代码示例来源:origin: kite-sdk/kite

/**
 * Reports the start index of this matcher's region. The searches this
 * matcher conducts are limited to finding matches within regionStart
 * (inclusive) and regionEnd (exclusive).
 *
 * @return The starting point of this matcher's region
 */
public int regionStart() {
  return matcher.regionStart();
}

代码示例来源:origin: dhanji/loop

public int regionStart() {
 return matcher.regionStart();
}

代码示例来源:origin: org.kitesdk/kite-morphlines-core

/**
 * Reports the start index of this matcher's region. The searches this
 * matcher conducts are limited to finding matches within regionStart
 * (inclusive) and regionEnd (exclusive).
 *
 * @return The starting point of this matcher's region
 */
public int regionStart() {
  return matcher.regionStart();
}

代码示例来源:origin: stackoverflow.com

String inputString1 = "asdasd|adajjsd|asas,asdas|asda|sd";
 String regex = "([a-z]*\\|[a-z]*\\|[a-z]*\\,?)+";
 Pattern pattern1 = Pattern.compile(regex);
 Matcher matcher1 = pattern1.matcher(inputString1);
 boolean result = matcher1.find();          
 System.out.println(inputString1.substring(matcher1.regionStart(), matcher1.regionEnd()));

代码示例来源:origin: ibinti/bugvm

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a string representing this {@code Matcher}.
 * The format of this string is unspecified.
 */
@Override public String toString() {
  return getClass().getName() + "[pattern=" + pattern() +
    " region=" + regionStart() + "," + regionEnd() +
    " lastmatch=" + (matchFound ? group() : "") + "]";
}

相关文章