Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8258119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:25:43+00:00 2026-06-08T02:25:43+00:00

I am having troubles with my regex to filter FTP server list to file/directory

  • 0

I am having troubles with my regex to filter FTP server list to file/directory name and size. This is the regex I’m currently using
(?m)^.{20}\\s*(\\d+).{14}(.*)$

So, using this to filter this list

drw-rw-rw- 1 ftp ftp                0 Mar 17 06:10 Tor Browser
-rw-rw-rw- 1 ftp ftp          1538814 Jun 26 00:23 setup.exe
-rw-rw-rw- 1 ftp ftp           142570 May 24 05:28 satellite A665-S6086.pdf

I will get Tor Browser, 0 and setup.exe, 1538814

which is what I actually wants but in a list of this format

 -r-xr-xr-x  1 0  1001     4521014 May 23  2011 FileZilla_3.5.0_win32-setup.exenull
 dr-xr-xr-x  4 0  1001  1024 Mar  2 14:07 pubnull

I will get something like: ay 23 2011 FileZilla_3.5.0_win32-setup.exe, 1 and 14:07 pub ,1.

Is there a way i can make this regex works for both types?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:25:45+00:00Added an answer on June 8, 2026 at 2:25 am

    I would use the following:

    Pattern regex = Pattern.compile(
        "(\\d+)        # File size           \n" +
        "\\s+          # Whitespace          \n" +
        "\\w{3}        # Month (3 letters)   \n" +
        "\\s+          # Whitespace          \n" +
        "\\d{1,2}      # Day (1 or 2 digits) \n" +
        "\\s+          # Whitespace          \n" +
        "[\\d:]{4,5}   # Time or year        \n" +
        "\\s+          # Whitespace          \n" +
        "(.*)          # Filename            \n" +
        "$             # End of line", 
        Pattern.MULTILINE | Pattern.COMMENTS);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having troubles here finding the right containers to represent a list of tasks on
I'm having some troubles getting regex to replace all occurances of a string within
I am having some troubles getting some regex to work to remove some text,
I'm using this jquery plugin: https://github.com/maranomynet/linkify/blob/master/1.0/jquery.linkify-1.0.js With this REGEX plugins I'm trying to linkify
I've almost got this regex working but am having trouble with the leading forward
Having trouble rewriting the name of a flash file: /flash/shell.1257347618.swf (the numbers are a
Having trouble determining if a file name conforms to a specific convention as follows.
I'm having troubles getting a regex to work. I'm trying to parse a large,
I am having troubles removing backslash from my string. The string is like this
I'm having trouble with this regex and I think I'm almost there. m =re.findall('[a-z]{6}\.[a-z]{3}\.[a-z]{2}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.