Coder Social home page Coder Social logo

codesaway / regexplus Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 372 KB

RegExPlus - extends Java's regular expression syntax by adding support for additional Perl and .NET syntax.

Home Page: http://codesaway.info/RegExPlus/

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%
regex regular-expression tasker-plugin

regexplus's People

Contributors

codesaway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

msnvip

regexplus's Issues

NullPointerException with regex ((?(1)2|3))

Exception in thread "main" java.lang.NullPointerException
at info.codesaway.util.regex.Refactor.anyCondition(Refactor.java:1339)
at info.codesaway.util.regex.Refactor.acceptTestingGroup(Refactor.java:1277)
at info.codesaway.util.regex.Refactor.refactorConditionalPattern(Refactor.java:2611)
at info.codesaway.util.regex.Refactor.refactor(Refactor.java:971)
at info.codesaway.util.regex.Refactor.(Refactor.java:461)
at info.codesaway.util.regex.Refactor.(Refactor.java:421)
at info.codesaway.util.regex.Pattern.compile(Pattern.java:3313)
at info.codesaway.util.regex.Pattern.(Pattern.java:3172)
at info.codesaway.util.regex.Pattern.compile(Pattern.java:1892)
at info.codesaway.util.regex.Pattern.compile(Pattern.java:1862)
at info.codesaway.util.regex.Pattern.compile(Pattern.java:1802)
at info.codesaway.util.RegexTesting.main(RegexTesting.java:10)

Sync up RegExPlus with functionality added in Java 7 / 8

For example, Pattern flag UNICODE_CHARACTER_CLASS

This allows \w and other built-in types to work with unicode characters. You can still pass the java.util.regex.Pattern int value, since RegExPlus uses Java's regex engine behind the scenes. However, adding this constant to RegExPlus directly will be much preferred.

Sync up Pattern Javadoc with Java 8 Javadoc

For example, some syntax was added to Java's regex, which works in RegExPlus (since under the hood I'm using Java's regex engine). However, my documentation is outdated and doesn't specify the new syntax (such as \h and \v).

Matcher.toMatchResult gets ClassCastException in Java 9

Java 9 added java.util.regex.Matcher$ImmutableMatchResult, which represents the MatchResult. Need to refactor code to handle this.

java.lang.ClassCastException: class java.util.regex.Matcher$ImmutableMatchResult cannot be cast to class java.util.regex.Matcher (java.util.regex.Matcher$ImmutableMatchResult and java.util.regex.Matcher are in module java.base of loader 'bootstrap')
at info.codesaway.util.regex.Matcher.clone(Matcher.java:263)
at info.codesaway.util.regex.Matcher.toMatchResult(Matcher.java:254)

LcsString diff0 method does not correctly create a valid diff in all cases (doesn't show correct number of matches)

LcsString diff0 method does not correctly create a valid diff in all cases (doesn't show correct number of matches)

		// diff0 has 0 matching characters, yet should be the same number as LCS
		// (this is yielding an invalid diff)
		LcsString lcsString = new LcsString("warningmsg", "naming");
		//		LcsString lcsString = new LcsString("naming", "warningmsg");

		System.out.println("LCS: " + lcsString.lcsLength());
		System.out.println(
				"diff match: " + lcsString.diff().stream().filter(d -> d.getType() == LcsDiffType.NONE).count());
		System.out.println(
				"diff0 match: " + lcsString.diff0().stream().filter(d -> d.getType() == LcsDiffType.NONE).count());

		System.out.println("diff()");
		lcsString.diff().forEach(System.out::println);
		System.out.println();

		System.out.println("diff0()");
		lcsString.diff0().forEach(System.out::println);

Add new methods added in Java 9 for Matcher class

  • appendReplacement​(StringBuilder sb, String replacement)
  • appendTail​(StringBuilder sb)
  • replaceAll​(Function<MatchResult,​String> replacer)
  • results()
  • replaceFirst​(Function<MatchResult,​String> replacer)

Also check Pattern to see what should be added

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.