How to bulk replace A.b to A('b') in Sublime? - sublimetext3

I want to bulk replace A.b to A('b') in Sublime text editor , but I don't know how to write the regex expression.
Any suggestion?

Use find and replace.
Cmd+f or cmd+shift+f
ctrl+f /crtr+shift+f (windows)

Related

I want to Replace a word which contains more no of / using vim

I want to replace this word /BGL/HUG/LIK/ to /TOM/GUY/MAP/ using vim editor I have tried %s/ commands it's not working please give some better solutions.
You can replace the separator / after %s with any character, so you can choose one that is not included in your source text, e.g.
%s,/BGL/HUG/LIK/,/TOM/GUY/MAP/,g
Hope this helps.

Sublime Text Editor snippet to remove parentheses

Sublime is able to add parentheses, brackets (curly and square), apostrophes, and quotes to highlighted text by default. I've tried but can't seem to find a way to have it remove those as well. What I'd like to be able to do is highlight some text that is surrounded by parentheses and have it remove those. Is there a good way to do that using snippets?
I suspect it can be done with use of allFollowingCharacter and allPrecedingCharacter but it seems those might be from a previous version of Sublime when those were in XML instead of the current JSON...?
Any help would be appreciated!
With surround you can do this. Install it via Package Control. (Package Control Installation)
Open the command palette:
CTRLSHIFTP on Linux and Windows,
CMDSHIFTP on Mac.
Search for Surround: delete surround and type in ( and Enter and you are done!
I'm surprised this question isn't searched more regularly!
BracketHighlighter is an excellent utility that includes convenient deleting of parenthesis. To cut to the chase, install BracketHighlighter and set bh_remove_brackets to whatever shortcut you'd like to be able to delete parentheses. Search up bh_remove_brackets in the example sublime keymap to see an example!

Search for quotation marks doesn't work in Sublime

How do I search for quotation marks in sublime?
I need to replace "file.jsp"/> with "file.jsp"> in more than 100 files
Is this possible to do in sublime using replace tool ?
I already tried backslash and it doesn't work. Any other solutions please?
Make sure that the option whole word (Alt + W) in the replace toolbar is turned OFF

How to use backspace escape sequence in Notepad++?

I need to use find new lines (\n) in a .txt file and replace them with a backspace (\b). Using this in the Find and Replace feature of Notepad++ successfully finds the new lines, (\n), but replaces them with the characters "\b" instead of applying a backspace. How can this be done correctly?
\r\n should work.
replace them with empty field and you will get your backspace(\b) equivalent
A simple way would be Ctrl + J or Edit->Line Operations->Join Lines
I was also trying to replace \n with backspace, but the above solutions seems neat. Maybe it helps someone.
(I tried the \r\n solution and it seems both works the same way :) )
In notepad++,
Go to Edit menu, line operations and then click on "Remove Empty Lines"
You get what you are trying with regular expression.
Removing empty lines
Use regular expressions, in Find what:, enter \r\n and in Replace with: leave that blank.

Notepad++ Search Multiple and Replace Respectively

Doing some String manipulation and I want to ask if the below is possible in Notepad++:
I have a string with Years:
10-Jan-13
22-Feb-14
10-Jan-13
10-Mar-13
I want
10-JAN-13
22-FEB-14
10-JAN-13
10-MAR-13
(There's more data on each line there but I am just showing a simplified example).
I know I can OR search with | character so find, JAN|FEB|MAR... but how do I replace according to what's found.
(Just trying to save some time)
Thanks.
Not sure if it's a plugin or built-in, but you can use the TextFX Characters plugin, to select the text, and then in the textfx characters dropdown, click UPPER CASE.
Update
Looks like it is a plugin:
TextFX menu is missing in Notepad++
Multiple Files
I found this site which gives a way to convert text to uppercase with regular expressions: http://vim.wikia.com/wiki/Changing_case_with_regular_expressions
So, what you can do is bring up the find in files dialog (CTRL+SHIFT+F), change search mode to Regular Expression, and then use something like this:
Find: (\d{2}-\w{3}-\d{2})
Replace with: \U\1
Directory: Whichever directory your files are in (and only the files you want changed).
\U is an uppercase flag, and the brackets in the Find regex correspond with the \1 backreference, which will basically replace it with itself (but uppercase).

Resources