Coder Social home page Coder Social logo

tony19 / named-regexp Goto Github PK

View Code? Open in Web Editor NEW
90.0 10.0 20.0 699 KB

Named capture groups for Java 5/6 regular expressions

Home Page: http://tony19.github.io/named-regexp/index.html

License: Apache License 2.0

Java 99.67% Shell 0.33%
regex android java

named-regexp's Introduction

named-regexp GitHub release Build

This library backports named capture groups from Java 7 to Java 5/6.

Usage

You can use the same constructs for named capture groups from Java 7 (i.e., (?<name>patt), etc.), as in the following example:

import com.google.code.regexp.Pattern;
import com.google.code.regexp.Matcher;

public class NamedRegexpTest {
    public static void main(String[] args) {
        // pattern contains capture group, named "foo"
        Matcher m = Pattern.compile("(?<foo>\\w+) world").matcher("hello world!");
        m.find();
        System.out.println(m.group("foo")); // prints "hello"
    }
}

Install

Gradle

implementation 'com.github.tony19:named-regexp:1.0.0'

Maven

<dependency>
  <groupId>com.github.tony19</groupId>
  <artifactId>named-regexp</artifactId>
  <version>1.0.0</version>
</dependency>

Maven Central

Build

To build named-regexp from source, use Maven 2 or higher and JDK 8 or higher:

$ git clone git://github.com/tony19/named-regexp.git
$ cd named-regexp
$ mvn package

To create Java 5/6 compatible bytecode, use JDK 11 or older to build this library. The build automatically targets Java 8 (the minimum supported version) if using a newer JDK to build.

Release

To release a new production version, run the following command:

$ ./release.sh

Releases are deployed to https://repo1.maven.org/maven2/com/github/tony19/named-regexp/

To release a SNAPSHOT (i.e., the version in pom.xml ends with -SNAPSHOT), run the following command:

$ mvn clean deploy

Snapshots are deployed to https://oss.sonatype.org/content/repositories/snapshots/com/github/tony19/named-regexp/

License

Copyright 2024 Anthony Trinh.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.