Replace string with random number/string using regex - regex

I have a angular project, we are using a plugin to show loading indicator.
The function goes like this
this.loading('Loading message')
Here Loading message is written everywhere. I need to find that exact source.
What I want to do is,
replace the Loading message with <random string/number> so that I can get exact source.
I am using notepad++, visual studio code. Can I do that using regex or any other way?
P.S. I have tried every other way, it is not possible to find the root cause any other way!
EDIT
I have to replace this string from all the files of a folder

Related

Doxygen: Is it possible to strip namespace names in CHM index?

I am working on a C++ project which makes extensive use of namespaces and doxygen. I prefer using the CHM file as compiled by MS HHC over the HTML directory for various reasons. One of them is the very convenient index search in the CHM viewer.
But the calls names in the index are always prefixed with their namespaces which forces the user of the CHM file to enter Namespace::Sub-Namespace::[...]::ClassName in the search.
Regarding this, I have changed the following settings in the doxygen configuration file (referring to the default that comes with the tool):
SHOW_NAMESPACES = NO
HIDE_SCOPE_NAMES = YES
This removes the namespace names everywhere except for the CHM index. (How) is it possible to get rid of the namespace prefixes in the CHM index as well?
As far as I know and tried with a small C# project the answer is - no.
One solution I see at this stage is to edit the resulting index.hhk and compile again by HTMLHelp Workshop. Please have a look into your index.hhk you'll find in your Doxygen HTML output subfolder.
The index.hhk file is a text file and can be openend by any text editor e.g. Notepad++. Having some namespaces only you make a RegEx for your needs and replace e.g. C_Sharp_CHM:: like shown in the screenshot below with NOTHING. But be careful using this and try before going to a production use case.
As you can see index.hhk is an old file format and not HTML as used today. Normally each index keyword has a link and a value (see screenshot, text format is edited here for better reading).
To compile the index.hhp you need to open the command prompt, navigate to your output folder and type "%programfiles(x86)%\HTML Help Workshop\hhc" index.hhp on a Windows 10 machine.

Sublime Text: interactive confirm for replace?

I need to do a lot of search/replace across 50+ files, and am using Sublime Text 3.
Is there a way to step through and interactively confirm each change? I dont't want a blanket Replace All action that just performs all replacements.
I am thinking way back to vi/vim with its %s/old/new/gc functionality.
Both the Find/Replace and Find in Files/Replace commands don't natively support prompting you if the replacement should happen. Regular in-buffer find/replace just replaces directly and the only confirmation that you can get is when you do a Find in Files and Sublime prompts you to confirm the replacement after telling you how many replacements will be made.
As such, the only way to get something like this is to look to an external plugin/package that would do it's own find and replace option so that you could be asked to confirm the changes.
I'm not personally aware of any packages that would do this, but a search in Package Control turns up the RegReplace package, which lists among its features:
Create commands that highlight results and requiring confirmation before replacing.
That said I've never used the package myself, and from briefly looking at the documentation site it seems like it's only capable of searching in the current document and not across files.
A potential workaround would be to use the native Find in Files to find all files with matches, then manually open them and use RegReplace to perform the same operation again.

An Xcode regex to find all classes which contain the text 'addObserver' but not 'removeObserver'?

I have an Xcode project with 200 or so class files. All of these classes need to have addObserver/removeObserver balanced or there's a risk of crashes so I'm trying to find a way to show the problem files without having to manually scan each one.
Tried this regex from another post...
^(?!.[\s\S]*removeObserver).[\s\S]*addObserver.*$
...but it is returning classes that contain removeObserver.

Remove alt attributes from HTML

I have a huge HTML file which I'm trying to format to be able to import the content into a different application. The one thing that remains is that I need to remove all alt attributes from the HTML entirely. They all have different values and there are around 5000 of them, so clearly a straight find & replace isn't an option. Perhaps there's a way to find and replace with regex in Visual Web developer?
The tools/skills I have available are: HTML, Javascript, ASP (Classic), a little bit of .NET, Visual Web Developer Express 2010, but the only similar things I can find are PHP-based and they don't explain fully enough for me to set up a solution and feed the HTML to it.
I've found things like this: Regular expression to replace several html attributes, which give suggestions of regex functions which do similar things, but I'm not even sure how to run a regex function on a straight HTML file (my browser is struggling with the size of the HTML file as it is, so I don't think javascript is going to cut it).
Can anyone suggest the best way to accomplish this?
Thanks folks...
Since you use Visual Studio, you can try the Regex search & replace option, though the implementation of regexes in Visual Studio is pretty different from other regex engines.
Here's a short article about it:
http://www.codinghorror.com/blog/2006/07/the-visual-studio-ide-and-regular-expressions.html
As it says in the article, the builtin regex engine isn't ideal. They mention a plugin with implements standard regexes though:
http://www.codeproject.com/Articles/9125/Standard-Regular-Expression-Searcher-Addin-For-VS

Is there an editor to autoindent / add spaces in existing code?

I have some JavaScript code which I want to make more readable. However, due to the amount of code I want to use a tool which does this automatically for me.
Are there such tools already available or do I have to manually perform some "find/replace-alls"?
The code which I want to convert is written on a single line without spaces.
Quick search found http://jsbeautifier.org/ which seems to do what you are looking for online.
Search terms: javascript beautifier