Package org.jostraca.util

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


        RegExp markRegExp = RegExp.make( includeBlockMark, RegExp.ModeSet.DotMatchesNewline );

        // include the file block
        String  includeFileContent  = FileUtil.readFile( pIncludeBase + File.separatorChar + includeBlockFile );       
        String  includeBlockContent = markRegExp.match( includeFileContent );

        // very important - prevent data loss
        if( Standard.EMPTY.equals( includeBlockContent ) ) {
          throw new TemplateException( TemplateException.CODE_includeblock_find,
                                       new ValueSet( ValueCode.FILE, includeBlockFile, ValueCode.VALUE, includeBlockMark ) );
View Full Code Here


  }


  public void doMatchRegExpTests( RegExpProvider pREP ) throws Exception {
    RegExp re01 = pREP.make( "a(.*?)c" );
    assertEquals( "abc",  re01.match( "abcc" ) );
    assertEquals( "b",    re01.matchFirstSub( "abcc" ) );

    RegExp re02 = pREP.make( "\\$a" );
    assertEquals( "$a",  re02.match( "$ab" ) );

View Full Code Here

    RegExp re01 = pREP.make( "a(.*?)c" );
    assertEquals( "abc",  re01.match( "abcc" ) );
    assertEquals( "b",    re01.matchFirstSub( "abcc" ) );

    RegExp re02 = pREP.make( "\\$a" );
    assertEquals( "$a",  re02.match( "$ab" ) );

    RegExp re03 = pREP.make( "a.b.", new RegExp.ModeSet( RegExp.Mode.DotMatchesNewline ) );
    assertEquals( "a\nb\n",  re03.match( "ca\nb\n" ) );

    RegExp re04 = pREP.make( "^[ \\t]*\\n(.*)", new RegExp.ModeSet( RegExp.Mode.DotMatchesNewline ) );
View Full Code Here

    RegExp re02 = pREP.make( "\\$a" );
    assertEquals( "$a",  re02.match( "$ab" ) );

    RegExp re03 = pREP.make( "a.b.", new RegExp.ModeSet( RegExp.Mode.DotMatchesNewline ) );
    assertEquals( "a\nb\n",  re03.match( "ca\nb\n" ) );

    RegExp re04 = pREP.make( "^[ \\t]*\\n(.*)", new RegExp.ModeSet( RegExp.Mode.DotMatchesNewline ) );
    assertEquals( "b\n",  re04.matchFirstSub( "\nb\n" ) );
  }

View Full Code Here

      String includeFileContent = FileUtil.readFile( includeFilePath, ( onlyifexists ? FileUtil.EMPTY_IF_IO_ERROR : FileUtil.FAIL_ON_IO_ERROR ) );
      String includeBlockMark = (String) pArguments.get(0);
     
      RegExp markRegExp = RegExp.make( includeBlockMark, RegExp.ModeSet.DotMatchesNewline );
      String includeBlockContent = markRegExp.match( includeFileContent );

      return includeBlockContent;
    }
    catch( Exception e ) {
      throw new TemplateException( TemplateException.CODE_includeblock,
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.