Package org.apache.xmlbeans.impl.regex

Examples of org.apache.xmlbeans.impl.regex.Match


     */
    public static String[] split(String source, String delimPattern)
    {
        ArrayList result = new ArrayList(3);
        RegularExpression re = new RegularExpression(delimPattern);
        Match matcher = new Match();

        if (re.matches(source, matcher))
        {
            int groups = matcher.getNumberOfGroups();
            int start = 0;
            for (int i = 0; i < groups; i++)
            {
                result.add(source.substring(start, matcher.getBeginning(i)));
                start = matcher.getEnd(i);
            }
            result.add(source.substring(start));
        }
        else
        {
View Full Code Here


     * Behaves exactly like JDK 1.4's String.replaceAll()
     */
    public static String replaceAll(String source, String pattern, String replace)
    {
        RegularExpression re = new RegularExpression(pattern);
        Match matcher = new Match();

        if (re.matches(source, matcher))
        {
            StringBuffer sb = new StringBuffer(source);
            replaceAll(matcher, sb, replace);
View Full Code Here

        else
            sb.append(StringUtils.replaceAll(testCase.getInstanceFile().getAbsolutePath(),
                "\\\\", "\\\\\\\\"));
        sb.append("\")'><xmp>");

        Match m = new Match();
        String desc = testCase.getDescription();
        if (leadingSpace.matches(desc, m))
        {
            StringBuffer sbDesc = new StringBuffer(desc);
            StringUtils.replaceAll(m, sbDesc, "");
View Full Code Here

    public void repackage ( StringBuffer sb )
    {
        for ( int i = 0 ; i < _fromPatterns.length ; i++ )
        {
            Match matcher = new Match();
            boolean matches = _fromPatterns[ i ].matches(sb.toString());

            if (matches)
                StringUtils.replaceAll(matcher, sb, _toPackageNames[ i ]);
        }
View Full Code Here

    public void repackageJavaFile ( String name )
        throws IOException
    {
        StringBuffer sb = readFile( new File( _sourceBase, name ) );

        Match packageMatcher = new Match();

        if (_packagePattern.matches(sb.toString(), packageMatcher))
        {
            String pkg = packageMatcher.getCapturedText( 1 );
            int pkgStart = packageMatcher.getBeginning( 1 );
            int pkgEnd = packageMatcher.getEnd( 1 );

            //group 0 is the whole package statement, 1 is package name
            if (packageMatcher.getNumberOfGroups() > 2)
                throw new RuntimeException( "More than one package specifications found: "
                        + name + ", numGroups=" + packageMatcher.getNumberOfGroups() );

            List filePath = Arrays.asList(StringUtils.split( name, File.separatorChar ));
            String srcDir = Repackager.dirForPath( name );

            // Sort the repackage spec so that longer from's are first to match
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.impl.regex.Match

Copyright © 2018 www.massapicom. 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.