Find and replace algorithm
Hello, i have some text files that contain <img width="100" or <img width="1400" or.... How could i replace all above with the following, since the image width is not static? <img width="200" ...
Hello, i have some text files that contain <img width="100" or <img width="1400" or.... How could i replace all above with the following, since the image width is not static? <img width="200" ...
I am a complete beginner to Python or any serious programming language for that matter. I finally got a prototype code to work but I think it will be too slow. My goal is to find and replace some Chinese characters across all files (they are csv) in a directory with integers as per a csv file I have. The files are nicely numbered by yea...
With jquery I am adding a div and appending the text "click to view" when the div is showin I would like to change that text to "click to close" Right now I have $('#toggle_template') .css('cursor','pointer') .append(' (click to view)') .click(function(){$('#template').toggle(500); $('#toggle_template').find(' ...
hi, i need to find and replace patterns in a string with a dynamically generated content. lets say i want to find all strings within '' in the string and double the string. a string like: my 'cat' is 'white' should become my 'catcat' is 'whitewhite' all matches could also appear twice in the string. thank you ...
My job is to do a find and replace in .doc and .docx files which are saved in sharepoint document library. i have to alter all the documents in the document library by doing find and replace. please help me in this... Open XML formats are only for word 2007 (.docx). I need single solution that would do find and replace in both .doc and ...
i have more than 1000 files and want to replace a special text in all of them with another phrase. how can i do it by shell script in linux? ...
Hello, I have a little Vim script which does a multi-line search and replace: vim -c 's/^ *<hi a=\"26\">\nHello/<td height=\"26\">\r<\/table>\r<bla \/>' \ -c 'w!' -c 'q' test.html That works. However, when I put that in a find -exec to do this recursively in the directory: find . -iname 'test.html' -exec \ vim -c 's/^ *<hi a=...
I'm still learning regex (obviously) and i can't figure it out, and i want to do it the right way rather than doing it the long way. How can I: Find all <p> or </p> and replace with a \n except the first <p> and last </p> in which case replace with nothing, just remove, and for <br>, <br /> and <br/> replace with \n also. With Regex OR...
Hi, actualy i have a very complex problem, but i have narrowed it down here to the most essential part with some dummy-data. Say i have the folowing text: a aa aaa aaaa aaaa aaaaa a aa aaa aaaa aaaaa aaaaaa aaaa a What i would like to do is, FOR EXAMPLE when a line of 4 a's is followed by a line of 1 a. I'd like to add a line of 3 a'...
someText 1 2 3 4 moreText I would like to add a prefix before each digit. but using (\w+\R)(\d+\R)+(\w+) and \1prefix\2\3 will only prefix the last digit and erase the others. Is there a way to do it with a single regex or should i write a script on the side? ...
I am using a regex within Visual Studio 2005 to turn my SQL statement into a readable string. I am using the find expression {.*} and the replace expression & "\1 " _. This should produce results something like: input: select * from x expected & "select * " _ & "from x " _ The reality is I am getting: & "select * " _& " "_ & "fr...
I have the following possible lines in my code addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler) addEventListener("click", propertyChangeHandler) addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, _propertyChangeHandler) addEventListener(PROPERTY_CHANGE, _propertyChangeHandler) They all have in common tha...
I'm cleaning up files using notepad ++, and trying to delete lines that start with \pard and have some text then end with a line feed. But \n doesn't work in regular expression and .* doesn't work in an extended find and replace. This is what I've tried unsuccessfully. \pard.*\n \pard.* works but leaves the line feed in regex. Any ide...
I want to replace the text PATHTOEXPORT with the contents of a variable passed on the command-line that would have a folder path in it (for example, /Dev_Content/AIX/Apache) I came across this article that discusses how to use sed to replace a value in an XML file with another. However, not having used sed before, I'm unsure how to rea...
Let's say I have a string like so: "Lorem ipsum de color [post]57[/post] sit amet [post]103[/post] desectator." I want to find all occurrences of [post]*[/post] and replace it with the title of the post represented by the number. I'd end up with something like so: "Lorem ipsum de color Angry Turtle sit amet Fuzzy Rabit dese...
Hi, I have a function that reads the content of an element, replaces a word with a link and then rewrites the content back into the element, obviously this means that all events that where previously set are lost. Does anyone know of a function/method that could find and replace content of an element without loosing the events? Thanks. ...