Package org.jostraca.util

Examples of org.jostraca.util.RegExp.replaceFirst()


  public void doReplaceRegExpTests( RegExpProvider pREP ) throws Exception {

    RegExp re01 = pREP.make( "a", "b" );
    assertEquals( "b",  re01.replaceAll( "a" ) );
    assertEquals( "bb", re01.replaceAll( "aa" ) );
    assertEquals( "ba", re01.replaceFirst( "aa" ) );
    assertEquals( "xb", re01.replaceFirst( "xa" ) );

    RegExp re02 = pREP.make( "a" );
    assertEquals( "",  re02.replaceAll( "a" ) );
   
View Full Code Here


    RegExp re01 = pREP.make( "a", "b" );
    assertEquals( "b",  re01.replaceAll( "a" ) );
    assertEquals( "bb", re01.replaceAll( "aa" ) );
    assertEquals( "ba", re01.replaceFirst( "aa" ) );
    assertEquals( "xb", re01.replaceFirst( "xa" ) );

    RegExp re02 = pREP.make( "a" );
    assertEquals( "",  re02.replaceAll( "a" ) );
   
    try {
View Full Code Here

    catch( RegExpException ree ) {
      //System.out.println( ree );
    }

    RegExp re04 = pREP.make( "a(b+)c", "ca$1" );
    assertEquals( "cabbbabbbc", re04.replaceFirst( "abbbcabbbc" ) );

    RegExp re05 = pREP.make( "A", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive ) );
    assertEquals( "bbc", re05.replaceFirst( "abc" ) );

    RegExp re06 = pREP.make( "A.", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive, RegExp.Mode.DotMatchesNewline ) );
View Full Code Here

    RegExp re04 = pREP.make( "a(b+)c", "ca$1" );
    assertEquals( "cabbbabbbc", re04.replaceFirst( "abbbcabbbc" ) );

    RegExp re05 = pREP.make( "A", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive ) );
    assertEquals( "bbc", re05.replaceFirst( "abc" ) );

    RegExp re06 = pREP.make( "A.", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive, RegExp.Mode.DotMatchesNewline ) );
    assertEquals( "bbc", re06.replaceFirst( "a\nbc" ) );
  }
View Full Code Here

    RegExp re05 = pREP.make( "A", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive ) );
    assertEquals( "bbc", re05.replaceFirst( "abc" ) );

    RegExp re06 = pREP.make( "A.", "b", new RegExp.ModeSet( RegExp.Mode.CaseInsensitive, RegExp.Mode.DotMatchesNewline ) );
    assertEquals( "bbc", re06.replaceFirst( "a\nbc" ) );
  }


  public void doMatchRegExpTests( RegExpProvider pREP ) throws Exception {
    RegExp re01 = pREP.make( "a(.*?)c" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.