remove anything after this string END_PAGEREFS and remove anything before BEGIN_PAGEREFS - notepad

i have large numbers of text files and i am in problem that i want to remove anything after this string END_PAGEREFS and remove anything before BEGIN_PAGEREFS as i want in between them.
using notepadd ++ or frontpage 2003 or powergrip software regular-expressions.info
help please

In notepad++, try opening some files, and replacing
BEGIN_PAGEREFS.*
and
END_PAGEREFS.*
marking the "Regular Expression" and "Replace in all opened files" options.

Related

\u0119 to ę in notepad++

I have searched all over the Internet for an answer. I have achieved this once before, but I can't remember how I did this...
I have a long text file with alot of encoded characters, for example
\u0119,\u015b\\u0107
How do I change characters like \u0119 to ę, etc?
This question is not off-topic. In past I also use notepad++ for programing. Today i use Atom. You can find a lot questions about notepad++ in stack overflow - for instance: Removing duplicate rows in Notepad++ or this Convert tabs to spaces in Notepad++ (and many more). So please do not give minus points to this question.
Answer: I assume that when you go to menu>Encoding you will see 'Encde in UTF-8.'
I use this site to create part of my answer: https://superuser.com/questions/576431/notepad-inserting-special-unicode-characters-in-utf-8
If you see character codes like \u0119,\u015b\u0107 in your file this probably mean that they are just on encoded - and their codes are put expliicty as raw text.
So to change this codes into UTF-8 characters, go to
menu>run>run> type: charmap> click run
the windows charmap will show up, so check ''advanced view' an there put you character code (without \u prefix - so for instance only 0119) in filed 'go to Unicode'. Then click on 'select' and 'copy' and close window
Then go to menu>search>replace and in filed 'replece with' past you character, and inf filed 'find what' put its code (with prefix, for instance \u0119). And click 'Replace All'
Do steps 1-3 for each character code (you can check thad your done when you click menu>find> and type '\u' in "find what". If you not find any code then you job is end.

Stop eclipse renaming inside strings

I've been having this problem for some time and have never bothered to fix it since Eclipse has a horrible help system and I can't seem to find the right Google keywords to find what I need.
My problem is that when I refactor a class name, eclipse looks for all potential locations of that name and replaces them.
For instance, if I have a string inside a test case for the "list command" that says something like, "List - list all the users on a team", when I refactor the List.java class to something like UserListCommand.java, the expression inside the string also changes to "UserListCommand - list all the users on a team"
This is SOOO annoying! And like I said, Google is useless when you cannot even think of the right keywords to use.
Has anyone else had this problem and solved it?
Thanks in advance.
Eclipse calls this updating textual occurrences in comments and strings. I sometimes turn this on so javadoc gets updated correctly if I didn't properly link it. But it can be a pain because it sometimes replaces substrings that match.
I've only seen this when renaming classes or interfaces (methods don't seem to do this, at least not for me),
You need to open the Rename Dialog to stop eclipse from updating textual occurrences in comments and strings:
Highlight the type you want to rename, then either:
press Shift+Alt+R
Right click, then go to refactor->rename.. then instead of typing the new name, there should now be a yellow context popup menu under the class name to be changed which says "Enter new name, press Enter to refactor", notice that there is a down arrow to expand the menu. If you press that instead of enter a new name a new drop down menu appears, select Open Rename Dialog...
Once the Rename Dialog is open:
uncheck "update textual occurences in comments and strings (forces preview)" and "Update fully qualified names in non-Java text files (forces preview)"
Hope that helps

Replacing a string in Rubymine with a string with newlines

I want to use the Search and Replace dialogue in Rubymine, or something similar to replace something like "Scenario:" with "#Desktop\nScenario"
I'm trying to replace every instance of Scenario: in a large Cucumber test suite with
#desktop
Scenario:
Any best ways to do this?
Update:
Thanks to #ryan2johnson9 comment, I realise there's now an easier option (tested on 2017.3).
By clicking on the "New Line" (or using the shortcut Ctrl+Shift+Enter / Alt+Enter), the input becomes multilines.
Original Answer
In the search and replace box, if you tick the "Regex" option you can do:
Search: "Scenario:"
Replace by: "#desktop\nScenario:"
The only trick is to tick the "Regex" option :)
Rubymine has macros (http://www.jetbrains.com/ruby/webhelp/binding-macros-with-keyboard-shortcuts.html) but I dont think they are powerful enough for this example.
It's possible that you could solve it with some elaborate feature hidden inside Rubymine, but I think it would be a lot easier to do this with a tool like perl/sed from the Terminal. If you are using Windows I assume you could search the net and find a text search/replace tool that fits your need.
In OSX I there are a bunch of Text Substitutions app too.
I would go that route since Rubymines macro tool isnt up to the task.
Here's a cheap and sleazy alternative:
Copy a newline character from between two empty lines in the file being edited. Temporarily add two empty lines if you don't have any.
Set up search/replace and enter the string you want to replace into the search text input box.
Paste the newline you just copied into the replacement text box plus whatever other text you want. You will be able to see the height of the replacement text input box grow vertically by one line due to the newline.
Perform the search/replace.
For this, the use of the Rubymine regex is optional.

Remove blank line in Eclipse

How can I remove lines that only contain spaces when using Eclipse Find/Replace prompt. I checked the "Regular Expression" check box, and tried the following, neither of which worked.
^[:space:]*$
and
^\s*$
Find: ^\s*\n
Replace with: (empty)
sry this might be an different answer but you can set the number of blank lines you wish to have after fields, methods and blocks in the formatting dialog of the eclipse preferences. then you can hit ctrl-shift-f to automatically format your code depending on your custom definitions.
have fun!
I was suprised that for XML files edited with Eclipse there is a good solution:
Select the checkbox value named 'Clear all blank lines' in Formatting panel
Window->Preferences->XML->XML Files-> Editor
Save and use the "Ctrl+Shift+F' shortcut
The blank lines will dissappear!
for the find/replace operation, "\n\r\s" regex will work on windows, for unix based system, "\n\s" can be used
as already suggested, you can format your code by Ctl+Shift+F
for manual work, locate a blank line and press Ctl+D (Cmd+D on Mac) <- gives u satisfaction of killing the line with your own bare hands :)
cheer!
This one worked for me for years:
Replace this: [\t ]+$
With nothing
Hope this helps!
Many thanks to lamamac.
In genereal, when you want to do search replace with regular expressions in eclipse the $ sign doesn't work as it should.
Use '\s*\n' instead of '$'
As already suggested, regular expression and replacement is the solution, but such response would have been saving some minutes to me:
click on ctrl+f
use this replacement:

How can I clean source code files of invisible characters?

I have a bizarre problem: Somewhere in my HTML/PHP code there's a hidden, invisible character that I can't seem to get rid of. By copying it from Firebug and converting it I identified it as  or 'Zero width no-break space'. It shows up as non-empty text node in my website and is causing a serious layout problem.
The problem is, I can't get rid of it. I can't see it in my files even when turning Invisibles on (duh). I can't seem to find it, no search tool seems to pick up on it. I rewrote my code around where it could be, but it seems to be somewhere deeper in one of the framework files.
How can I find characters by charcode across files or something like that? I'm open to different tools, but they have to work on Mac OS X.
You don't get the character in the editor, because you can't find it in text editors. #FEFF or #FFFE are so-called byte-order marks. They are a Microsoft invention to tell in a Unicode file, in which order multi-byte characters are stored.
To get rid of it, tell your editor to save the file either as ANSI/ISO-8859 or as Unicode without BOM. If your editor can't do so, you'll either have to switch editors (sadly) or use some kind of truncation tool like, e.g., a hex editor that allows you to see how the file really looks.
On googling, it seems, that TextWrangler has a "UTF-8, no BOM" mode. Otherwise, if you're comfortable with the terminal, you can use Vim:
:set nobomb
and save the file. Presto!
The characters are always the very first in a text file. Editors with support for the BOM will not, as I mentioned, show it to you at all.
If you are using Textmate and the problem is in a UTF-8 file:
Open the file
File > Re-open with encoding > ISO-8859-1 (Latin1)
You should be able to see and remove the first character in file
File > Save
File > Re-open with encoding > UTF8
File > Save
It works for me every time.
It's a byte-order mark. Under Mac OS X: open terminal window, go to your sources and type:
grep -rn $'\xFEFF' *
It will show you the line numbers and filenames containing BOM.
In Notepad++, there is an option to show all characters. From the top menu:
View -> Show Symbol -> Show All Characters
I'm not a Mac user, but my general advice would be: when all else fails, use a hex editor. Very useful in such cases.
See "Comparison of hex editors" in WikiPedia.
I know it is a little late to answer to this question, but I am adding how to change encoding in Visual Studio, hope it will be helpfull for someone who will be reading this sometime:
Go to File -> Save (your filename) as...
And in File Explorer window, select small arrow next to the Save button -> click Save with Encoding...
Click Yes (on Do you want to replace existing file dialog)
And finally select e.g. Unicode (UTF-8 without signature) - that removes BOM