search-and-replace

How to program a text search and replace in PDF files

How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations to use text touchup, w...

Telerik RadEditor Find & Replace in HTML View

We use Telerik's RadEditor for our content management system's WYSIWYG editor. We need the find & replace functionality that is in the WYSIWYG editor to also be in the HTML editor. The editor is pretty customizable, anyone know if there is a way to enable this or hack it in? ...

How would I create a VIM or Vi command to delete all text after a certain character for every line in a text file?

Scenario: I have a text file that has pipe (as in the "|" character) delimited data. Each field of data in the pipe delimited fields can be of variable length, so counting characters won't work (or using some sort of substring function... if that even exists in VIM). Is it possible, using VIM / Vi to delete all data from the second p...

Visual Studio find doesn't find all possibilities

Recently, I've begun to notice that Visual Studio 2008 isn't finding all of the instances of a text I search for when I'm searching Entire Solution. It will start to search through the files to find a term, but then at some point, it stops searching other files, and starts alternating between only two files. This is very aggravating, b...

How can I have a VBA macro perform a Search/Replace in formulas across an entire workbook?

I distribute an Excel workbook to a number of users, and they are supposed to have a particular macro file pre-installed in their XLSTART folder. If they don't have the macro installed correctly, and they send the workbook back to me, any formulas depending on it include the full path of the macro, e.g.: 'C:\Documents and Settings\rich...

Find and replace in files - .NET friendly regular expression syntax

I'm looking for a decent tool that can do search and replace over multiple files, with regular expression syntax I'm use to in C#. Normally I would do this in Visual Studio, except it has the strangest regex syntax (and this is meant to be faster than just replacing the text in the files manually). So far I've tried windows grep but it ...

Regex replace, but only between two patterns

Ok, I have a multi-line string I'm trying to do some clean-up on. Each line may or may not be part of a big block of quoted text. Example: This line is not quoted. This part of the line is not quoted “but this is.” This one is not quoted either. “This entire line is quoted” Not quoted. “This line is quoted and so is this one and so is ...

Search and replace text contents of a tag

I am trying to specifically to pad out the /'s in an a tag's text. 1234/1234/ABCDE => 1234 / 1234 / ABCDE In context; if I have an a tag: <a href="http://www.domain.com/path/to/page.html"&gt;12 34/1234A/BC DEFG</a> I would like to get: <a href="http://www.domain.com/path/to/page.html"&gt;12 34 / 1234A / BC DEFG</a> ...

Shell script - search and replace text in multiple files using a list of strings

[edited] I have a file "changesDictionary.txt" containing (a variable number of) pairs of key-value strings. e.g. "textToSearchFor" = "theReplacementText" (The format of the dictionary is unimportant, and be changed as required.) I need to iterate through the contents of a given directory, including sub-directories. For each file en...

Emacs: Regular Expression Replacing to Change Case

Hi, Every once in a while I want to replace all instances of values like: <BarFoo> with <barfoo> i.e. do a regular expression replace of all things inside angle brackets with its lowercase equivalent. Anyone got a nice snippet of Lisp that does this? It's safe to assume that we're dealing with just ASCII values. Bonus points for ...

PHP: Parse a string to perform replacements

I have a group of text based rules that are structured like this: Rule 1: Do [XXX] when [PN] greater than [N] Rule 2: Get [PRD ..] and add [X.XX] To go with this is an array of data that translates each grouped code into a CSS class ID (for jQuery). I also have an array of translations from [code] to ID stored in a simple structured...

VBScript 800a005e Error

I'm using old VBScript in my ASP application. Trying to search and replace string using Replace(wholeText, textToSearch, textToReplace) function but i'm getting the following error: Microsoft VBScript runtime error '800a005e' Invalid use of Null: 'Replace' /instance/inst_spam_gen_4.asp, line 25 And here is my function: Function cl...

Regular Expression to Find/Replace in a Fix Length File

Hi, So I have this big file of fix length lines. I want to do a find and replace on a character line position. Example: xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx xxxxx So in this case I would want to find any value starting on position 13 through positio...

How can I replace each URL in a string with another unique URL?

I have the following: $reg[0] = '`<a(\s[^>]*)href="([^"]*)"([^>]*)>`si'; $reg[1] = '`<a(\s[^>]*)href="([^"]*)"([^>]*)>`si'; $replace[0] = '<a$1href="http://www.yahoo.com"$3&gt;'; $replace[1] = '<a$1href="http://www.live.com"$3&gt;'; $string = 'Test <a href="http://www.google.com"&gt;Google!!&lt;/a&gt;Test <a href="http://www.google.com"...

Case preserving substitute in Vim

Can this can be done in Vim? What I mean is: searching for 'BadJob' and replacing with 'GoodJob' would do the following replacements 'badjob' -> 'goodjob' 'BadJob' -> 'GoodJob' 'badJob' -> 'goodJob' 'BADJOB' -> 'GOODJOB' ...

best way of replacing all tags in a string with java

I have a service method that takes a String and then replaces tags in the String with items from a tag library. As follows: for( MetaDataDTO tag : tagValues ) { message = message.replace( tag.getKey(), tag.getText1() ); } Obviously; this make heaps of new strings and is BAD. But the StringBuilder replace method is cumbersome to ...

Replace an Expression Within Text Boundaries

I have a rather annoying issue that I solved using a simple recursive method in Java. However, I'm looking for a better way to do this. The initial problem involved the presence of whitespace within a Quoted Printable/Base64 encoded Mime header - which as I read the RFC 2047 specification - isn't allowed. This means that decoding fail...

Javascript multiple replace

How do you replace all instances of one string with another in javascript? Example: someString = 'the cat looks like a cat' anotherString = someString.replace('cat', 'dog'); results in anotherString being set to 'the dog looks like a cat', and I would like it to be 'the dog looks like a dog' ...

Seeking good examples of Find and Replace user interfaces in text editors and IDEs

I'm working on a Windows application with an integrated text editor, like an IDE. The current Find and Replace features use the standard Windows dialogs, which are showing their age and aren't very powerful. What great examples do you know of Find and Replace functionality, in text editors or IDEs? I'm looking for inspiration for look...

How to search and replace all instances of a string within a database?

Hey everyone, I have a string that is contained inside of a wordpress install (the name of a server) thousands of times, across multiple columns, records and tables. I'd like to update it with the location of another server - we are moving the content over. So the source would be something like http://my-server1/some/link/to/something...