replace
How to remove all characters before a specific character in Java?
You can use .substring(): String s = “the text=text”; String s1 = s.substring(s.indexOf(“=”) + 1); s1.trim(); then s1 contains everything after = in the original string. s1.trim() .trim() removes spaces before the first character (which isn’t a whitespace, such as letters, numbers etc.) of a string (leading spaces) and also removes spaces after the last … Read more
multiple replaces with javascript [duplicate]
Use javascript’s .replace() method, stringing multiple replace’s together. ie: var somestring = “foo is an awesome foo bar foo foo”; //somestring lowercase var replaced = somestring.replace(/foo/g, “bar”).replace(/is/g, “or”); // replaced now contains: “bar or an awesome bar bar bar bar”
Multiple REPLACE function in Oracle
Even if this thread is old is the first on Google, so I’ll post an Oracle equivalent to the function implemented here, using regular expressions. Is fairly faster than nested replace(), and much cleaner. To replace strings ‘a’,’b’,’c’ with ‘d’ in a string column from a given table select regexp_replace(string_col,’a|b|c’,’d’) from given_table It is nothing … Read more
Replacing quote marks around strings in Vim?
There’s also surround.vim, if you’re looking to do this fairly often. You’d use cs'” to change surrounding quotes.
Search and replace inside a rectangle in emacs
If you enable CUA selection mode: M-x cua-selection-mode RET or permanently in your init file: (cua-selection-mode 1) You can then use its advanced rectangle editing facilities. (or if you’re a cua-mode user, then you don’t need to do that.) C-RET to mark a corner. Move point to opposite corner. M-r to do a regexp replace … Read more
regex string replace
This should work : str = str.replace(/[^a-z0-9-]/g, ”); Everything between the indicates what your are looking for / is here to delimit your pattern so you have one to start and one to end [] indicates the pattern your are looking for on one specific character ^ indicates that you want every character NOT corresponding … Read more
Search and replace in Visual Studio
In Visual Studio 2012, capture groups and backreferences are used just like in C#. You can capture them with common parenthesis, and backreference them with $0, $1, etc. Hope it helps! Note that the syntax $1 is used for find-replace, but \1 is used for backreferences in the search string.