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

  • Home
  • SEARCH
  • 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 8045617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:36:15+00:00 2026-06-05T05:36:15+00:00

Given the text public void MyFunction(int i, String str, boolean doIt) { Log.i(TAG, Enter

  • 0

Given the text

public void MyFunction(int i, String str, boolean doIt) {
    Log.i(TAG, "Enter MyFunction(int i, String str, boolean doIt)");

I want to make some replacements on the second line, but not the first

public void MyFunction(int i, String str, boolean doIt) {
    Log.i(TAG, "Enter MyFunction( i:" + i + ", str:" + str ", doIt:" + doIt + ")");

So far using the following regex I manage to get these results:

find “\w+\s+(\w+)([,\)])“
replace with “$1:" + $1 + "$2“

public void MyFunction(i:" + i + ", str:" + str ", doIt:" + doIt + ") ") {
    Log.i(TAG, "Enter MyFunction( i:" + i + ", str:" + str ", doIt:" + doIt + ") ");

Is there any way to force the replace to be executed only on the Log.i lines?

EDIT:
I tried the following regex
“Log\.i\(.*?\((\s*(\w+\s+(\w+)([,\)]))+“
but $1,$2,$3 only contains the last match (the last argument: doIt)

$1=boolean doIt)
$2=doIt
$3=)

when there should be 3 sets of $1,$2,$3, one for each argument.
If you know how to retrieve multiple matches, that would also make for a solution

  • 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-05T05:36:16+00:00Added an answer on June 5, 2026 at 5:36 am

    I caved,

    I used this little perl to do the job:

    next unless /Log\.i/;
    s/TAG,/TAGG/;
    s/(final\s+)?[^ \(]+\s+(\w+)([,\)])/$2:\" \+ $2 \+ \"$3/g;
    s/TAGG/TAG,/;
    

    with the command line:

    perl -pi <scriptname> <file>
    

    If someone still wants to contribute some, I understand I could have run perl as Eclipse external tool to process the java files. How do I do that?

    UPDATE:

    I wrote a post on how to use external perl to run the script from within Eclipse IDE
    see the post

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to remove all the white spaces from a given text file. Is
Given a text string containing a type name, is there some way to get
I am trying to plot Heaps law for a given text (it shows the
I'm indexing and searching code using a custom analyzer. Given text will wi-fi work,
I am looking for a reliable way of extracting text given the web address,
Given a large text block from a WYSIWYG like: Lorem ipsum dolor sit amet,
given a plain text file, how can I do, using bash, awk, sed, etc,
given a plain text document with several lines like: c48 7.587 7.39 c49 7.508
alt text http://img216.imageshack.us/img216/2288/problem11.png As given in the picture, I have an search bar in
Given a data stream of continuously arriving items containing a timestamp and text (e.g.

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.