How to convert "string" to "*s*t*r*i*n*g*"
I need to convert a string like "string" to "*s*t*r*i*n*g*" What's the regex pattern? Language is Java. ...
I need to convert a string like "string" to "*s*t*r*i*n*g*" What's the regex pattern? Language is Java. ...
Is there an easy way to capture types? I can't seem to do basic things like use variable expressions side by side, such as $mapType$$mapEnd$ to do a simple replacement. Is there any reason this might be? That is, if I have a single expression, say .*\s*.*abc, and I break it into two variables, .*\s* and .*abc, the expression does not mat...
I have a large number of records of the following type, which I have to modify I would like to remove the created_by="29" line without leaving a space. Note: A wild card inside the created_by value would be preferable I would like to remove the entire line creation_date="..." and the /> greater should move after state="1"/> Insert a ne...
Hi, I have a copy of a log file I want to make easier to view/edit. I use textpad to remove stuff I do not want and I can enter a regular expression as search term and use \1.\2.\3.\4 in the target field for captured groups. I would like to change all IP addresses which start each line from [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,...
I have an input C file (myfile.c) that looks like this : void func_foo(); void func_bar(); //supercrazytag I want to use a shell command to insert new function prototypes, such that the output becomes: void func_foo(); void func_bar(); void func_new(); //supercrazytag So far I've been unsuccessful using SED or PERL. What didn't w...
Hello all, I have a file that uses the pipe character as a separator since I assumed that most of my clients wouldn't use the pipe character in their data. Apparently I was wrong, but I compensated for this by specifying that any fields using the pipe character need to be wrapped in double quotes. Unfortunately, they haven't done this, ...
I'm using a DataGrid to display the values of specific properties of a collection of objects. I've implemented search and cell highlighting through a similar method to the one on Tomer Shamam's blog. However, I now need to implement 'Find/Replace' type functionality. I presumed I would be able to iterate through the DataGrid's cells to ...
Does someone know a easy way to find characters in Unicode that are similar to ASCII characters. An example is the "CYRILLIC SMALL LETTER DZE (ѕ)". I'd like to do a search and replace for similar characters. By similar I mean human readable. You can't see a difference by looking at it. ...
Is there an alternative way to do the following one-liner replacement of text across all files in a Rails app? perl -pi -e 's/replaceme/thereplacement/g' $(find . -type f) Perl complains that there are too many files if I include the RAILS_ROOT, but it works for subdirectories. ...
I have a string. I want to search for a single slash and then replace "\" (single slash) with a "\" (double slash). string Method1(string s) { string upadtedString = s; if (s.Contains("\\")) { //do nothing } else if(s.Contains("\")) { string s1 = "\"; string s2 = "\\"; u...
My program should process an input string. But when "\mesg" is sent in Method1, the else block is executed instead of the if block. void Method() { string str = "\\Mesg"; str = Method1(str); Console.WriteLine(str); } string Method1(string s) { string upadtedString = s; if (s.Contains(@"\\")) { ...
For the sake of simplicity, let's say that we have input strings with this format: *text1*|*text2* so, I want to leave text1 alone, and remove all spaces in text2 This could be easy if we didn't have text1, a simple search and replace like this one would do: %s/\s//g but in this context I don't know what to do. I tried with somet...
I like the Search And Replace Dialog of Excel 2010. I can enter data, see it replace in the grid behind AND THEN I can edit the data in grid without the Search/Replace Window disappearing/going into background. The SearchAndReplace Window is not a Model dialog. And it also has not settings like "stay at Top" = true because switching to ...
My script lists out files in the directory. I am able to use preg_match and regex to find files whose filenames contain integers. However, this is what I am unable to do: I want an entire string to be omitted if it contains an integer. Despite trying several methods, I am only able to replace the integer itself and not the entire line....
/** Constant <code>IDX_USER="IDX_+ USER_ID"</code> */ I have several lines of code which was generated by javadoc and show up something like the above. I would want to find all lines starting with /** Constant IDX_ and all the way to the end of the line. How should I do this? Will be using the regex search and replace capability in Ec...
I am trying to convert a file which contains ip address in the traditional format to a file which contains ip address in the binary format. the file contents are as follows. src-ip{ 192.168.64.54 } dst-ip{ 192.168.43.87 } The code i have is as follows. import re from decimal import * filter = open("filter.txt", "r") output = open...
Resharper 5's new pattern matching seems very powerful, though it takes a bit of tinkering to work out how to use it. For those who aren't familiar with this feature, it allows you to search for specific patterns within your code. Instances of such patterns may optionally be replaced with an alternative. In IntelliJ this was called st...
I found This. But It Dosent work. Not sure what I am doing wrong. In Sheet 1 I want to search and replace certain terms. Such as WH with White, PK with Pink, TT with Two Tone, YE with Yellow and so on. I have a list in sheet three with what to find in one column and what to replace in the same row in the next column. Now I want to us...
We have a property file (name, value key pairs) and would like to replace everything beyond the equal sign = with nothing. How do I do that? label.one=One label.two=Two Post replacement, I would want label.one= label.two= ...
I'm looking for a greedy RegEx match to replace all text in a number of HTML files between </title> and </head> (I've combined loads of JavaScript files to minimize the number of http requests). I've googled it but the majority of the solutions don't seem to work for me. (Which naturally leads me to assume that i'm wrong) This is my ...