replace

Replacing a specific bit of text in all php files on a server?

So I just got my sorry ass hacked, the hack put some obscure string in almost every one of the php files on my website. How can I remove every instance that line occurs? The code it added started with <?php so therefore I cannot simply replace it with blank, I need to delete it and move up the actual relevant code up one line as <?php c...

Function to hide sloppy phone numbers..

I need to hide phone numbers (and maybe other contact details) in user generated content to protect my users from anonymous web. Input is very random, therefore I'd be looking to replace anything that looks like a phone number (e.g.: string of 3 or more numbers) with just dots, and also perhaps remove some exotic notations of e-mail add...

Javascript or jquery replace text

I need to replace some text that is on the page within the body tag. I am using javascript but have jquery available if needed. I basically need to replace test (test with the registered trademark) with TEST or tests with TESTS and it could even be test with TEST or tests with TESTS. I am able to uppercase them but its not liking to work...

sqlite regex replace html

Is there a way to execute a SQL statement in SQLite to remove all the html from a TEXT field? ...

Create a replace function in vb.net

Please Help me in creating a replace function. Problem: Their is a alfanumeric value of any lenght (string) and i want to replace its all characters with 'X' except right four characters Like : Value : 4111111111111111 Result Should be: XXXXXXXXXXXX1111 I have created a function but got stuck: public function myfunction...

LINQ-to-SQL load keyword from variable

public IQueryable<ArticleDisplay> SearchNumberOfArticles(int articleNr, string order) var result = ( from category in db.ArticleCategories join article in db.Articles on category.CategoryID equals article.CategoryID orderby article.Date order ...

javascript/jquery input fields cleanup

I've created a few input fields, that I am cleaning up as the user types. So, I'm using a keystroke detection event, like .keyup() It's all working very well, but I do notice one thing that's rather annoying for the users. While the script is cleaning the data as they type, their cursor is being sent to the end of the input field. So...

Need to replace HTML single-quote entity in MySQL

Hi, I currently have the following MySQL statement to replace the HTML entity for a single quote with an actual single quote: update photo_galleries replace(title, '&#39;', '\''); This statement returns an error. I have tried adding additional backslashes, but this does not help at all. I want to run this command using pure SQL (no PH...

String replace diacritics in C#

I'd like to use this method to create user-friendly URL. Because my site is in Croatian, there are characters that I wouldn't like to strip but replace them with another. Fore example, this string: ŠĐĆŽ šđčćž needs to be: sdccz-sdccz So, I would like to make two arrays, one that will contain characters that are to be replaced and other ...

Regex - find and replace complete string occurrences only (not partial matches)

I'm not very good at regex but maybe there's a simple way to achieve this task. I'm given a string like "bla @a bla @a1 bla" I'm also given pairs like {"a", "a2"} , {"a1", "a13"}, and I need to replace @a with @a2 for the first pair, and @a1 with @a13 for the second one. The problem is when i use String.Replace and look for @a, it als...

ASP.NET MVC Controller parameter processing

In my application I have a string parameter called "shop" that is required in all controllers, but it needs to be transformed using code like this: shop = shop.Replace("-", " ").ToLower(); How can I do this globally for all controllers without repeating this line in over and over? Thanks, Leo ...

File.Replace throwing IOException

I have an app that can make modify images. In some cases, this makes the filesize smaller, in some cases bigger. The program doesn't have an option to "not replace the file if result has a bigger filesize". So I wrote a little C# app to try and solve this. Instead of overwriting the files, I make the app write the result to a folder u...

finding and replacing elements in a list (python)

Hey I have to search through a list and replace all occurrences of one element with another. I know I have to first find the index of all the elements, and then replace them, but my attempts in code are getting me nowhere. Any suggestions? ...

Add / remove a port number to/from a URL with REGEX in PHP

Hello guys, I've searched but was unable to find an existing regex function. Has anybody done this before? I wish to add a port number, or remove a potantially existing one from a url in php. To use in some functions which translate a given url to the secure one, unsecure one, etc. Now I need a second SSL secured site on the server so...

JQuery - add/remove forms and divs

Hey I'm sure I've seen examples somewhere before, but I can't seem to find them. I have a page which has 5 buttons. I'd like each button to load up a different form, without refreshing. I could use UpdatePanels, but it sounds overkill for this (and bandwidth-costly). I'd like to load all the forms in one go, so clicking through the but...

How does MatchEvaluator works? ( C# regex replace)

This is the input string 23x * y34x2. I want to insert " * " (star surrounded by whitespaces) after every number followed by letter, and after every letter followed by number. So my input string would look like this: 23 * x * y * 34 * x * 2. This is the regex that does the job: @"\d(?=[a-z])|a-z". This is the function that I wrote that i...

Replace text in div when image is clicked

Hello, I'm trying to replace certain text inside the div "info" when an image (which serve as links) is clicked. I'm just unsure of what methods could do this. I would prefer this be jquery. My code so far looks like: <div class="info"> <p>I would like this text replaced</p> <script> </script> </div><!--end info--> <li><a href="1....

How to make this regular expression?

I want to replace all line break (<br> or <br />) in a string with PHP. What regular expression I should have to do this, using preg_replace? Thanks! ...

Can I write this regex in one step?

This is the input string "23x +y-34 x + y+21x - 3y2-3x-y+2". I want to surround every '+' and '-' character with whitespaces but only if they are not allready sourrounded from left or right side. So my input string would look like this "23x + y - 34 x + y + 21x - 3y2 - 3x - y + 2". I wrote this code that does the job: Regex reg1 = n...

HTML Agility Pack - ReplaceNode doesn't change the InnerHTML of the Body

Hi there, I have this The body: <body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent leo leo, ultrices eu venenatis et, rutrum fringilla dolor.</p></body> The code: HtmlNode body = doc.DocumentNode.SelectSingleNode("//body"); Dictionary<HtmlNode, HtmlNode> toReplace = new Dictionary<HtmlNode, HtmlNode>(); /...