简体   繁体   中英

Regular Expression to exclude files

I need to write some regular expressions for a FTP operation wherein the job should

  1. Poll multiple folders starting only with alphabets. The home drive contains folders starting with '..' and hence cd .. takes it back.
  2. Exclude any files that start with '.' or 'local'
  3. Pick files that do not end with a particular string. On this one I wrote an expression but found that it does not works for all cases.

Can anyone suggest a water tight expression to say, not pick files ending with ABC and XYZ?

I think this should work: [a-zA-Z][\\S]*^(ABC|XYZ) but Im not 100% sure of all the details of your requirements. What the regex should be saying is anything that starts with an alphabetic letter and then has as many non-white space characters as it wants and then does NOT end in ABC or XYZ.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM