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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:59:07+00:00 2026-06-17T10:59:07+00:00

I am attempting to create a macro in jEdit. I am attempting to remove

  • 0

I am attempting to create a macro in jEdit. I am attempting to remove all the white space from the start of every line in a buffer. Here’s the jEdit macro (i.e. Java) code I have attempting to do that:

textArea.goToBufferStart(false);
//Set up SearchAndReplace defaults
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setWholeWord(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());

public int replace(String from, String to) {
  //must be reg-ex escaped prior to call
  SearchAndReplace.setSearchString(from);
  SearchAndReplace.setReplaceString(to);
  return SearchAndReplace.replaceAll(view);
}

boolean done = false;
while (!done) {
  int count = replaced("\\n ", "\\n");
  found = (count > 0);
}

The documentation that comes with jEdit 5.0 indicates that the call SearchAndReplace.replaceAll(view) returns the number of buffers within which replacements occurred. But when I execute it, I get an error indicating that it does not return an int, but a boolean.

While it would be nice if it did return an int, I would like to be able to know the specific count of replacements that occurred within a specific buffer (the only one against which I am executing the macro).

So, I must be approaching this wrong. Any suggestions on how I can implement my intended effect, remove all whitespace from the start of every line? BTW, the macro currently ignores the first line intentionally. I know it is a defect and will correct that later.

Thank you for any direction you can give me.

  • 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-17T10:59:08+00:00Added an answer on June 17, 2026 at 10:59 am

    If you want to strip whitespace from the beginning of every line, simply

    • Open search and replace with ctrl+f
    • Enter in ^[ \t]+ into the Search for box:
    • check regular expressions
    • click replace all
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i'm attempting to create an alias/script to download all specific extensions from a
I'm attempting to create a single Controller class to handle all foreseeable surveys that
I'm attempting to create a class and inherit from Toplevel() so that the GUI
I am attempting to create a Java source file which will interface with my
I am attempting to create a linked server from a 2005 to 2008 Microsoft
Im attempting to create a simple list out of some elements I stole from
I'm attempting to create an ajax function that returns a specific string from a
I'm attempting to create a very large image in Java like so: BufferedImage bi
In attempting to create a thread-safe container class from scratch, I've run into the
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in

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.