Search Results

Search found 53464 results on 2139 pages for 'find and replace'.

Page 12/2139 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Using preg_replace to replace all occurrences in php

    - by Greg-J
    Regex is absolutely my weak point and this one has me completely stumped. I am building a fairly basic search functionality and I need to be able to alter my user input based on the following pattern: Subject: %22first set%22 %22second set%22-drupal -wordpress Desired output: +"first set" +"second set" -drupal -wordpress I wish I could be more help as I normally like to at least post the solution I have so far, but on this one I'm at a loss. Any help is appreciated. Thank you.

    Read the article

  • Regex to replace 'li' with 'option' without losing class and id attributes

    - by Earthman Web
    I am looking for a solution using preg_replace or similar method to change: <li id="id1" class="authorlist" /> <li id="id2" class="authorlist" /> <li id="id3" class="authorlist" /> to <option id="id1" class="authorlist" /> <option id="id2" class="authorlist" /> <option id="id3" class="authorlist" /> I think I have the pattern correct, but not sure how to do the replacement part... Here is the (wordpress) php code: $string = wp_list_authors( $args ); //returns list as noted above $pattern = '<li ([^>]*)'; $replacement = '?????'; echo preg_replace($pattern, $replacement, $string); Suggestions, please?

    Read the article

  • php search and replace first element in div

    - by cnotethegr8
    i have a structure that looks like this <div class="table"> <div> <p> name1 </p> <p> title1 </p> </div> <div> <p> name2 </p> <p> title2 </p> </div> <div> <p> name3 </p> <p> title3 </p> </div> </div> and it continues a few hundred more times. what can i write in php that will search ( class="table" div ) and add a class to only the first 'p' in each 'div'?

    Read the article

  • Text replace with regex in SQL Server

    - by Thiyaneshwaran S
    Currently I have a SQL server column of type nvarchar(max) which has text that starts with <span class="escape_<<digits>>"></span> The only thing that varies in the pattern is the <<digits>> in the class name. The common part is <span class="myclass_ and the closing </span> Some sample values are <span class="myclass_12"></span> <span class="myclass_234"></span> <span class="myclass_4546"></span> These span text are present only at the beginning of the column. Any such matching span in the middle should not be removed or matched. Whats the SQL Server query with regex to remove all these occurances of span?

    Read the article

  • VIM Replace word with contents of paste buffer?

    - by plong
    I need to do a bunch of word replacements in a file and want to do it with a vi command, not an EX command such as :%s///g. I know that this is the typical way one replaces the word at the current cursor position: cw<text><esc> but is there a way to do this with the contents of the unnamed register as the replacement text and without overwriting the register?

    Read the article

  • Replace non-html links with <A> tags

    - by tombazza
    I have a block of code that will take a block of text like the following: Sample text sample text http://www.google.com sample text Using the preg_replace_callback method and the following regular expression: preg_replace_callback('/http:\/\/([,\%\w.\-_\/\?\=\+\&\~\#\$]+)/', create_function( '$matches', '$url = $matches[1]; $anchorText = ( strlen($url) > 35 ? substr($url, 0, 35).\'...\' : $url); return \'<a href="http://\'. $url .\'">\'. $anchorText .\'</a>\';'), $str); Will convert the sample text to look like: Sample text sample text < a href="http://www.google.com"http://www.google.com< /a sample text My problem now is that we have introduced a rich text editor that can create links before being sent to the script. I need to update this piece of code so that it will ignore any URLs that are already inside an tag.

    Read the article

  • C# Regex - Replace multiple characters at once without overwriting?

    - by Everaldo Aguiar
    Hello guys, I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher. The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example: Plain text(input): THIS IS A TEST Cipher alphabet: A - Y, H - Z, I - K, S - L, E - J, T - Q Cipher Text(output): QZKL KL QJLQ I thought of using regular expressions since I've been programming in perl for a while, but I'm encountering some problems on c#. First I would like to know if someone would have a suggestion for a regular expression that would replace all occurrence of each letter by its corresponding cipher letter (provided by user) at once and without overwriting anything. Example: In this case, user provides plaintext "TEST", and on his cipher alphabet, he wishes to have all his T's replaced with E's, E's replaced with Y and S replaced with J. My first thought was to substitute each occurrence of a letter with an individual character and then replace that character by the cipherletter corresponding to the plaintext letter provided. Using the same example word "TEST", the steps taken by the program to provide an answer would be: 1 - replace T's with (lets say) @ 2 - replace E's with # 3 - replace S's with & 4 - Replace @ with E, # with Y, & with j 5 - Output = EYJE This solution doesn't seem to work for large texts. I would like to know if anyone can think of a single regular expression that would allow me to replace each letter in a given text by its corresponding letter in a 26-letter cipher alphabet without the need of splitting the task in an intermediate step as I mentioned. If it helps visualize the process, this is a print screen of my GUI for the program: http://img43.imageshack.us/img43/2118/11618743.jpg

    Read the article

  • .NET Regex - Replace multiple characters at once without overwriting?

    - by Everaldo Aguiar
    I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher. The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example: Plain text(input): THIS IS A TEST Cipher alphabet: A - Y, H - Z, I - K, S - L, E - J, T - Q Cipher Text(output): QZKL KL QJLQ I thought of using regular expressions since I've been programming in perl for a while, but I'm encountering some problems on c#. First I would like to know if someone would have a suggestion for a regular expression that would replace all occurrence of each letter by its corresponding cipher letter (provided by user) at once and without overwriting anything. Example: In this case, user provides plaintext "TEST", and on his cipher alphabet, he wishes to have all his T's replaced with E's, E's replaced with Y and S replaced with J. My first thought was to substitute each occurrence of a letter with an individual character and then replace that character by the cipherletter corresponding to the plaintext letter provided. Using the same example word "TEST", the steps taken by the program to provide an answer would be: 1 - replace T's with (lets say) @ 2 - replace E's with # 3 - replace S's with & 4 - Replace @ with E, # with Y, & with j 5 - Output = EYJE This solution doesn't seem to work for large texts. I would like to know if anyone can think of a single regular expression that would allow me to replace each letter in a given text by its corresponding letter in a 26-letter cipher alphabet without the need of splitting the task in an intermediate step as I mentioned. If it helps visualize the process, this is a print screen of my GUI for the program:

    Read the article

  • c# Find value in a range using lambda

    - by n4rzul
    I'm trying to find an item in a list of values based on another value using a lambda expression using the Find method. In this example I'm expecting to get back -1000, but for the life of me, I just can't come up with the proper lamda expression. If that sounds confusing I hope the code and comments below explain it better. TIA. using System; using System.Collections.Generic; namespace TestingStuff { class Program { static void Main(string[] args) { double amount = -200; //The Range of values List<MyValue> values = new List<MyValue>(); values.Add(new MyValue(-1000)); values.Add(new MyValue(-100)); values.Add(new MyValue(-10)); values.Add(new MyValue(0)); values.Add(new MyValue(100)); values.Add(new MyValue(1000)); //Find it!!! MyValue fVal = values.Find(x => (x.Value > amount) && (x.Value < amount)); //Expecting -1000 as a result here since -200 falls between -1000 and -100 //if it were -90 I'd expect -100 since it falls between -100 and 0 if (fVal != null) Console.WriteLine(fVal.Value); Console.ReadKey(); } } public class MyValue { public double Value { get; set; } public MyValue(double value) { Value = value; } } }

    Read the article

  • Using ed to manipulate files matched by find

    - by TheOsp
    Following the bash-hackers wiki's recommendation, I want to edit files using ed. In particular I want to do the following with ed instead of sed: find . -type f -exec sed -i -e 's/a/b/g' {} \; I see that ed doesn't have opt like sed's -e, so as far as I know, pipes and io redirections are the only way to work with it non-interactively. So, using ed from a bash script to do the same as the above sed command would look like: ed file_name <<<$'g/a/s//b/g\nw' Or echo $'g/a/s//b/g\nw' | ed file_name But as far as I know it is impossible to involve pipes or io redirections within find's -exec. Do I miss something? or is the only way to overcome this is to use loops? for file in $(find . -type f -print); do ed $file <<<$'g/a/s//b/g\nw'; done;

    Read the article

  • browser ctrl-f find and non-visible text

    - by David Pilling
    Can the browser feature of contrl+F to find text be integrated with text in popup windows. I'd like to have some scientific reference information given when someone hovers over a species name in a web page. Generating the popup, tooltip style text is no problem, the problem is that anyone using Ctrl+F won't be able to find it, or if I position the text out of view when not required, it will be found but be invisible. The same sort of effect applies to "accordion" style expanding text areas. I'm looking for some sort of event generated when find is highlighting a result.

    Read the article

  • Rails find by *all* associated tags.id in

    - by mark
    Hi Say I have a model Taggable has_many tags, how may I find all taggables by their associated tag's taggable_id field? Taggable.find(:all, :joins => :tags, :conditions => {:tags => {:taggable_id => [1,2,3]}}) results in this: SELECT `taggables`.* FROM `taggables` INNER JOIN `tags` ON tags.taggable_id = taggables.id WHERE (`tag`.`taggable_id` IN (1,2,3)) The syntax is incredible but does not fit my needs in that the resulting sql returns any taggable that has any, some or all of the tags. How can I find taggables with related tags of field taggable_id valued 1, 2 and 3? Thanks for any advice. :)

    Read the article

  • How to find text in images with the browser control+F

    - by Riga
    Have HTML pages with many sections and each section has a section title displayed as an image (to use nice font). The problem is that even if I specify an 'alt' and 'title' text on each image/title the Ctrl+F browser functionality does not find the text. Thought two possible solutions but not very happy about them 1) Use embed fonts. Problem: Can not find the font required by client to use and not sure about copyrights. 2) Have the text in the image in DIV near the image but hidden from user view. Problem: Can search engines consider this keyword stuffing? Will browser find text if display:none Does anybody has a better solution? Thanks Riga

    Read the article

  • how to use a bash function defined in your .bashrc with find -exec

    - by sharrajesh
    my .bashrc has the following function function myfile { file $1 } export -f myfile it works fine when i call it directly rajesh@rajesh-desktop:~$ myfile out.ogv out.ogv: Ogg data, Skeleton v3.0 it does not work when i try to invoke it through exec rajesh@rajesh-desktop:~$ find ./ -name *.ogv -exec myfile {} \; find: `myfile': No such file or directory is there a way to call bash script functions with exec? Any help is greatly appreciated. Thanks, sharrajesh

    Read the article

  • Find an asp:Button in VB.NET

    - by Andrew
    I'm trying to code a section for my website in VB but VB can't seem to find a button. Is there a way for the code to find it? I know where it is. Loginview Login LoginTemplate. How do I get VB.NET to point to that location?

    Read the article

  • grails find first

    - by srinath
    I know this is simple question but taking more time How to find first record from table in grails . I need to get only the first record with out knowing the id number . Is there any method like find :first in grails ? thanks in advance .

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >