I am trying to use regular expression in IBM RAD / eclipse to search and replace entire code base/Java Web Project(jsp, java) of specific matching crieria.
What I am trying to do is, I am searching for
method(string, string)
and to replace it with
method(string, string, string) // adding additional argument.
For Example:
method("Employee", "Language")
method("Customer", "Lang");
I want to replace all method(*,*,"TOKEN");
I have searched like method(*,*) and returns all, but while trying to replace method(*, *, TOKEN), it is replacing as "*"...any help..not that much familiar with regular expression..already searched many threads and still searching..any help would be greatful..thanks
if you select the methodname e.g:
public void getAngle(){..}
and you select ´getAngle()´ and press ´alt+shift+c´ , you should be able to modify the method signature
Related
I have logs which contains in full_message;
-EndPoint:example/example/abc
-EndPoint:example/example/qfdsf
-EndPoint:example/example
.. and so on
I am trying to write a search query to just get -EndPoint:example/example.
"-EndPoint:example/example" is not working
and I cant use "and" or "or" cause there hundreds of versions
Why and how can't/can I get only -EndPoint:example/example which doesn't have / at the end ?
You can use the following regex:
"-EndPoint:example/example$"
It search for the string, making sure, it's the end of the string.
When I try to search some keywords in VS 2010, it just provides me Match Case, Match whole word Search Up. There is also regular expression option as well but when I try to deal with that, it's being a nightmare.
For example :
Let's say I have a variable that I use it in most of my stored procedures as an input.
And I have defined it as :
create procedure myProc (#myInputVar NVARCHAR(5)) ....do something...
but in some of my stored procedures, I have defined them with tabs (maybe 3-4 tabs) I.E.
create procedure myProc2 (#myInputVar NVARCHAR(5)) ..... do something ...
I want to replace myInputVar type from String to INT. When I search "#myInputVar NVARCHAR(5)" keyword with search (Ctrl+F), it doesn't find the another stored procedure. I tried all options above which I have as search options.
Since I have a lot of procs (some has 3 tabs between type and name of the inout variable, some has 2 tabs, some has just white space), its being frustrating.
For instance, when we search something on Google, it doesn't care how many spaces between each word. It just shows the related words.
Is there any way to do it? with regular expression or something else?
You can use this regexp:
for search box:
(\#myInputVar[\s\t]+)NVARCHAR\(5\)
and for replace box:
$1INT
I have a lot of java files:
Foo01.java
Foo02.java
Foo03.java
Foo04.java
Foo05.java
Foo01Bar.java
Foo01Bar.java
Foo02Bar.java
Foo03Bar.java
Foo04Bar.java
Foo05Bar.java
And I need to replace an expression in and only in FooXX.java classes.
Using CTRL + H in eclipse, in the file name pattern, I tried Foo(\d\d).java, but It does not work. If I write Foo*.java, every FooXXBar.java will also appears, and I don't want to.
What's the way to do it?
I don't think eclipse has the capability to do full regular expressions on file names. As far as I know you can use * to match any string and ? to match any single character for a file. As a result if your file list is similar to the above you can search for:
Foo??.java
For more complex file searches you probably need to use a combination of the unix/windows command line tools (depending on your OS choice).
I have classes with many, many empty methods called getFieldNameX or getFieldNameY (implementing a big interface for many columned linq to sql tables). I want to insert return values using find and replace.
This is that have
Function GetInsertedDate() as Date implements myInterface.getInsertedDate
End Function
This is what I want:
Function GetInsertedDate() as Date implements myInterface.getInsertedDate
return me.insertedDate //"return me." + method signature minus get
End Function
Is there any way to do this with find and replace?
Find: myInterface\.get{.+}\n\n
Replace: myInterface.get\1\n\treturn me.\1\n
Use: Regular expressions
search for getInsertedDate
and replace with getInsertedDate\n\treturn me.insertedDate with Use: Regular expressions enabled
I am a Vim-user lost in the Emacs-style Regex of Info-reader. I want to match:
$ info find
?How-in-Info-reader? :%s#\(\\;.*\\+\)\|\(\\+.*\\;\)#WORKS!#g
INFO: "C-X n" to go through the matches
I am looking for the Emacs-counterpart for the Vim-command marked with "?How-in-Info-reader?".
How can you find the matches in Info-reader?
For the standalone info reader, your choices are more limited than when using Emacs proper for browsing *info* pages.
I'm not familiar with the details of ?How-in-Info-reader, but there are two ways (I can see to search in the standalone info browser.
M-x index-apropos SOMESTRING
will give you a list of all the index nodes which contain SOMESTRING.
And the other searches C-s (for interactive search) and / or s (non-interactive search) for a particular string in the current view (they don't drop down into the nodes).
I think you're trying to replace either backslash-semi-anystring-backslashes or backslashes-anystring-backslash-semi with "WORKS!" everywhere in the file. It doesn't look like info is an editor. it doesn't even look like it has regex searching. In emacs, I'd type esc-control-s (to get incremental regular expression search, which means you can try out expressions and see how they work).
Once you're in emacs, the search string you presented should work just fine if I've understood your question. You can also type Esc-r, and then type the first string ("\(\\;.*\\+\)\|\(\\+.*\\;\)"), a RETURN, and the replacement string ("#WORKS!").