@Test public void testGetRegexpFinal() throws Exception { Pattern pattern = SubstringNode.getRegex( "", new String[] { "" }, "Test" ); boolean b1 = pattern.matcher( "test just a Test" ).matches(); assertTrue( b1 ); boolean b3 = pattern.matcher( "test just a test" ).matches(); assertFalse( b3 ); }
public static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ) { StringBuilder buf = new StringBuilder(); if ( initialPattern != null ) { buf.append( '^' ).append( Pattern.quote( initialPattern ) ); } if ( anyPattern != null ) { for ( int i = 0; i < anyPattern.length; i++ ) { buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) ); } } if ( finalPattern != null ) { buf.append( ".*" ).append( Pattern.quote( finalPattern ) ); } else { buf.append( ".*" ); } return Pattern.compile( buf.toString() ); }
SubstringNode extends LeafNode { public static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ) { StringBuilder buf = new StringBuilder(); if ( initialPattern != null ) { buf.append( '^' ).append( Pattern.quote( initialPattern ) ); } if ( anyPattern != null ) { for ( int i = 0; i < anyPattern.length; i++ ) { buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) ); } } if ( finalPattern != null ) { buf.append( ".*" ).append( Pattern.quote( finalPattern ) ); } else { buf.append( ".*" ); } return Pattern.compile( buf.toString() ); } }
SubstringNode extends LeafNode { public static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ) { StringBuilder buf = new StringBuilder(); if ( initialPattern != null ) { buf.append( '^' ).append( Pattern.quote( initialPattern ) ); } if ( anyPattern != null ) { for ( int i = 0; i < anyPattern.length; i++ ) { buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) ); } } if ( finalPattern != null ) { buf.append( ".*" ).append( Pattern.quote( finalPattern ) ); } else { buf.append( ".*" ); } return Pattern.compile( buf.toString() ); } SubstringNode( AttributeType attributeType, String initialPattern, String finalPattern );  SubstringNode( String attribute, String initialPattern, String finalPattern );  SubstringNode( AttributeType attribute );  SubstringNode( String attributeType );  SubstringNode( List<String> anyPattern, AttributeType attributeType, String initialPattern,
        String finalPattern );  SubstringNode( List<String> anyPattern, String attribute, String initialPattern, String finalPattern ); }
SubstringNode extends LeafNode { public static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ) { StringBuilder buf = new StringBuilder(); if ( initialPattern != null ) { buf.append( '^' ).append( Pattern.quote( initialPattern ) ); } if ( anyPattern != null ) { for ( int i = 0; i < anyPattern.length; i++ ) { buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) ); } } if ( finalPattern != null ) { buf.append( ".*" ).append( Pattern.quote( finalPattern ) ); } else { buf.append( ".*" ); } return Pattern.compile( buf.toString() ); } SubstringNode( AttributeType attributeType, String initialPattern, String finalPattern );  SubstringNode( String attribute, String initialPattern, String finalPattern );  SubstringNode( AttributeType attribute );  SubstringNode( String attributeType );  SubstringNode( List<String> anyPattern, AttributeType attributeType, String initialPattern,
        String finalPattern );  SubstringNode( List<String> anyPattern, String attribute, String initialPattern, String finalPattern ); static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ); @Override ExprNode clone(); final String getInitial(); void setInitial( String initialPattern ); final String getFinal(); void setFinal( String finalPattern ); final List<String> getAny(); void setAny( List<String> anyPattern ); void addAny( String anyPattern ); final Pattern getRegex( Normalizer normalizer ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override String toString(); }
SubstringNode extends LeafNode { public static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ) { StringBuilder buf = new StringBuilder(); if ( initialPattern != null ) { buf.append( '^' ).append( Pattern.quote( initialPattern ) ); } if ( anyPattern != null ) { for ( int i = 0; i < anyPattern.length; i++ ) { buf.append( ".*" ).append( Pattern.quote( anyPattern[i] ) ); } } if ( finalPattern != null ) { buf.append( ".*" ).append( Pattern.quote( finalPattern ) ); } else { buf.append( ".*" ); } return Pattern.compile( buf.toString() ); } SubstringNode( AttributeType attributeType, String initialPattern, String finalPattern );  SubstringNode( String attribute, String initialPattern, String finalPattern );  SubstringNode( AttributeType attribute );  SubstringNode( String attributeType );  SubstringNode( List<String> anyPattern, AttributeType attributeType, String initialPattern,
        String finalPattern );  SubstringNode( List<String> anyPattern, String attribute, String initialPattern, String finalPattern ); static Pattern getRegex( String initialPattern, String[] anyPattern, String finalPattern ); @Override ExprNode clone(); final String getInitial(); void setInitial( String initialPattern ); final String getFinal(); void setFinal( String finalPattern ); final List<String> getAny(); void setAny( List<String> anyPattern ); void addAny( String anyPattern ); final Pattern getRegex( Normalizer normalizer ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override String toString();  }