public SftpFile[] matchRemoteFiles(String remote)
			throws SftpStatusException, SshException {

		String actualDir;
		String actualSearch;
		int fileSeparatorIndex;
		if ((fileSeparatorIndex = remote.lastIndexOf("/")) > -1) {
			actualDir = remote.substring(0, fileSeparatorIndex);
			actualSearch = remote.length() > fileSeparatorIndex + 1 ? remote
					.substring(fileSeparatorIndex + 1) : "";
		} else {
			actualDir = cwd;
			actualSearch = remote;
		}

		SftpFile[] files;
		RegularExpressionMatching matcher;
		switch (RegExpSyntax) {
		case GlobSyntax:
			matcher = new GlobRegExpMatching();
			files = ls(actualDir);
			break;
		case Perl5Syntax:
			matcher = new Perl5RegExpMatching();
			files = ls(actualDir);
			break;
		default:
			matcher = new NoRegExpMatching();
			files = new SftpFile[1];
			String actual = resolveRemotePath(remote);
			files[0] = getSubsystemChannel().getFile(actual);
		}

		return matcher.matchFilesWithPattern(files, actualSearch);
	}
public SftpFile [ ] matchRemoteFiles ( String remote ) throws SftpStatusException , SshException { String actualDir ; String actualSearch ; int fileSeparatorIndex ; if ( ( fileSeparatorIndex = remote . lastIndexOf ( "/" ) ) > - 1 ) { actualDir = remote . substring ( 0 , fileSeparatorIndex ) ; actualSearch = remote . length ( ) > fileSeparatorIndex + 1 ? remote . substring ( fileSeparatorIndex + 1 ) : "" ; } else { actualDir = cwd ; actualSearch = remote ; } SftpFile [ ] files ; RegularExpressionMatching matcher ; switch ( RegExpSyntax ) { case GlobSyntax : matcher = new GlobRegExpMatching ( ) ; files = ls ( actualDir ) ; break ; case Perl5Syntax : matcher = new Perl5RegExpMatching ( ) ; files = ls ( actualDir ) ; break ; default : matcher = new NoRegExpMatching ( ) ; files = new SftpFile [ 1 ] ; String actual = resolveRemotePath ( remote ) ; files [ 0 ] = getSubsystemChannel ( ) . getFile ( actual ) ; } return matcher . matchFilesWithPattern ( files , actualSearch ) ; }
Called by getFileMatches() to do regular expression pattern matching on
the files in 'remote''s parent directory.

@param remote
@return SftpFile[]
@throws SftpStatusException
@throws SshException