org.joni.Regex.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(181)

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

Regex.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

public JoniRegexEngine(String regex, int flags) {
 this.regex = regex;
 byte[] b = Bytes.toBytes(regex);
 this.pattern = new Regex(b, 0, b.length, patternToJoniFlags(flags), encoding, Syntax.Java);
}

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

Regex r = new Regex("YOURREGEX");

// search for a match within a string
r.search("YOUR STRING YOUR STRING");

if(r.didMatch()){
// Prints "true" -- r.didMatch() is a boolean function
// that tells us whether the last search was successful
// in finding a pattern.
// r.left() returns left String , string before the matched pattern 
int index = r.left().length();
}

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

Regex r = new Regex(@"^(\1.|^.)+$");

Console.WriteLine(r.IsMatch("aababc"));     // True
Console.WriteLine(r.IsMatch("1121231234")); // True
Console.WriteLine(r.IsMatch("iLoveRegEx")); // False

for (int n = 0; n <= 50; n++) {
  Match m = r.Match("".PadLeft(n));
  if (m.Success) {
    Console.WriteLine("{0} = sum(1..{1})", n, m.Groups[1].Length);
  }
}
// 1 = sum(1..1)
// 3 = sum(1..2)
// 6 = sum(1..3)
// 10 = sum(1..4)
// 15 = sum(1..5)
// 21 = sum(1..6)
// 28 = sum(1..7)
// 36 = sum(1..8)
// 45 = sum(1..9)

代码示例来源:origin: apache/phoenix

public JONIPattern(String patternString, int flags, Encoding coding) {
  this.patternString = patternString;
  if (patternString != null) {
    byte[] bytes = patternString.getBytes();
    pattern = new Regex(bytes, 0, bytes.length, flags, coding, Syntax.Java);
  } else {
    pattern = null;
  }
}

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

Regex r = new Regex("=([^;]*);");
Match m = r.Match(yourData);
while (m.Success) {
  string match = m.Groups[1];
  // match should be the text between the '=' and the ';'.
}

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

Regex r = new Regex(
 @"(?x) ^.{0,1}$ | ^(?: (?=(\2?)) (?=(\2\3|^.)) (?=(\1)) \2)+ . $ "
);

for (int n = 0; n < 1000; n++) {
 if (r.IsMatch("".PadLeft(n))) {
  Console.Write("{0} ", n);
 }
}
// 0 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987

代码示例来源:origin: org.apache.hbase/hbase-client

public JoniRegexEngine(String regex, int flags) {
 this.regex = regex;
 byte[] b = Bytes.toBytes(regex);
 this.pattern = new Regex(b, 0, b.length, patternToJoniFlags(flags), encoding, Syntax.Java);
}

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

static void Main(string[] args)
 {
   var sourceMapFolder = new DirectoryInfo(args[0]);
   foreach (var sourceMapFile in sourceMapFolder.EnumerateFiles("*.map"))
   {
     var sourceMapFilePath = sourceMapFile.FullName;
     var regex = new Regex(",\\s*[^\\s\\\";]{1,3}?(;|\\\")");
     var oldContent = File.ReadAllText(sourceMapFilePath);
     var newContent = regex.Replace(oldContent, "$1");
     File.WriteAllText(sourceMapFilePath, newContent);
   }
 }

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

Regex re = new Regex("^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{1,})+$");
if (!re.IsMatch (domain.Text)) {
  warningLabel.Text = "Domain format is invalid!";
  formError = true;
}

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

string myString = "B12";
Regex rx = new Regex(@"[A-Za-z](\\d+)");
MatchCollection matches = rx.Matches(myString);
if (matches.Count > 0)
{
  Match match = matches[0]; // only one match in this case
  GroupCollection groupCollection = match.Groups;
  Console.WriteLine("serial " + groupCollection[1].ToString());
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

public JoniRegexEngine(String regex, int flags) {
 this.regex = regex;
 byte[] b = Bytes.toBytes(regex);
 this.pattern = new Regex(b, 0, b.length, patternToJoniFlags(flags), encoding, Syntax.Java);
}

代码示例来源:origin: org.netbeans.api/org-jruby

private void makeRegexp(ByteList bytes, int start, int len, int flags, Encoding enc) {
  try {
    pattern = new Regex(bytes.bytes, start, start + len, flags, enc, Syntax.DEFAULT, this);
  } catch(Exception e) {
    rb_reg_raise(bytes.bytes, start, len, e.getMessage(), flags);
  }
}

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

var reg = new Regex("(\\d+)$");

var matches = reg.Matches("some string 0123");

List<string> found = new List<string>();

if(matches != null)
{
  foreach(Match m in matches)
    found.Add(m.Groups[1].Value);
}

//do whatever you want with found

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

Regex r = new Regex("^data:(.*?);base64,(.*?)$");
Match m = r.Match(fileData);
if(m.Success) {
  string mimeType = m.Groups[1].Value;
}

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

Try this
string ss = "<b><i>The tag is about to be removed</i></b>";
 Regex regex = new Regex("\\<[^\\>]*\\>");
 Response.Write(String.Format("<b>Before:</b>{0}", ss)); // HTML Text
 Response.Write("<br/>");
 ss = regex.Replace(ss, String.Empty);
 Response.Write(String.Format("<b>After:</b>{0}", ss));// Plain Text as a  OUTPUT

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

string s = "FREQ=WEEKLY;WKST=MO;BYDAY=22TU,-2WE,+223FR";
Regex r = new Regex(@"(?:;BYDAY=|,)([+-]?[0-9]+)([A-Z]{2})");
foreach (Match m in r.Matches(s))
{
 Console.WriteLine("Interval: {0,5}, Day of Week: {1}",
          m.Groups[1], m.Groups[2]);
}

代码示例来源:origin: net.thisptr/jackson-jq

public Pattern(final String regexText, final String flags) throws JsonQueryException {
  final int modifiers = parseModifiers(flags) | Option.CAPTURE_GROUP;
  final byte[] regexBytes = regexText.getBytes(StandardCharsets.UTF_8);
  this.regex = new Regex(regexBytes, 0, regexBytes.length, modifiers, UTF8Encoding.INSTANCE, Syntax.PerlNG);
  this.global = isGlobal(flags);
  this.names = names(regex);
}

代码示例来源:origin: eiiches/jackson-jq

public Pattern(final String regexText, final String flags) throws JsonQueryException {
  final int modifiers = parseModifiers(flags) | Option.CAPTURE_GROUP;
  final byte[] regexBytes = regexText.getBytes(StandardCharsets.UTF_8);
  this.regex = new Regex(regexBytes, 0, regexBytes.length, modifiers, UTF8Encoding.INSTANCE, Syntax.PerlNG);
  this.global = isGlobal(flags);
  this.names = names(regex);
}

代码示例来源:origin: org.jruby/jruby-core

private static Regex makeRegexp(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) {
  try {
    int p = bytes.getBegin();
    return new Regex(bytes.getUnsafeBytes(), p, p + bytes.getRealSize(), options.toJoniOptions(), enc, Syntax.DEFAULT, runtime.getRegexpWarnings());
  } catch (Exception e) {
    RegexpSupport.raiseRegexpError19(runtime, bytes, enc, options, e.getMessage());
    return null; // not reached
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private static Regex makeRegexp(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc) {
  try {
    int p = bytes.getBegin();
    return new Regex(bytes.getUnsafeBytes(), p, p + bytes.getRealSize(), options.toJoniOptions(), enc, Syntax.DEFAULT, runtime.getRegexpWarnings());
  } catch (Exception e) {
    RegexpSupport.raiseRegexpError19(runtime, bytes, enc, options, e.getMessage());
    return null; // not reached
  }
}

相关文章