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 8727593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:27:43+00:00 2026-06-13T08:27:43+00:00

I have a long text which contains paths to some files. What I want

  • 0

I have a long text which contains paths to some files.

What I want to do is to remove the paths from it.
The filepaths are all something like:

some text 1
/all/extraItems/Java/.Scripts/.Sample1.js
some text 2
/all/extraItems/Android/.Scripts/.Sample2.js
some text 3

I know that using “^/all” will select a sentence that starts with /all and also .js$ for ending with .js. But I cannot merge these together to select the whole filepath.

After all the Regular Expression should be placed on the following code to remove the Paths.

text.replaceAll(<RegularExpression> , "");

Who can I write the regEx for it? Is there any tool?

  • 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-13T08:27:45+00:00Added an answer on June 13, 2026 at 8:27 am

    If you want to “merge” them you will have to match the characters in between, as well:

    ^/all.*?\.js$
    

    . matches any character, * repeats the previous character 0 or more times, ? makes the repetition ungreedy, avoiding a match going over multiple lines. Since you are using Java, you need to escape the backslash once more in your string:

    "^/all.*?\\.js$"
    

    If you do not use the multiline option already (which you actually need to do, for ^/all and js$ to work on your input), you can do that like this:

    "(?m)^/all.*?\\.js$"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some text which occasionally contains very long strings of characters, which is
I have a text file which contains a long list of words. Some of
I have a long text which contains: city_nameLAcity_name some text here and there ;)
I have a custom exception class which contains some additional fields. I want these
Greetings All; I have a LinkedList of type String which contain some words like
I have a serious long else if statement which contains some links and some
E.g. I have a div that contains all the text like: <div class=text-container> <p>
I'm developing in Java and I have a long string of text which contains
I have a block of text which occasionally has a really long word/web address
I have a long text and I'd like to offer the user a reading

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.