Search Results

Search found 7634 results on 306 pages for 'preg replace'.

Page 7/306 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Easiest way to recursively find and replace?

    - by FarmBoy
    I want to recursively search through a directory of text files and replace every occurrence of foo within the files with bar. What is the easiest way to accomplish this? I imagine that grep would do the job in one line, but I can't seem to find an example of this. I'm working in OS X.

    Read the article

  • Problem with Replace in Eclipse

    - by Imran
    I'm using regex to match all non-quoted property names in my json files. Eclipse has no problem finding the desired matches, but when I want to replace the matched strings with "$2", I get this error: Match string has changed in file filename.json. Match skipped Here's the regex I'm using: `((\w+)\s*(?!['"])(?=:))` Any idea on how to work around this issue?

    Read the article

  • Find and replace braced tags within a MySQL table

    - by Cy
    I have about 40000 records in that table that contains plain text and within the plain text, contains that kind of tags which its only characteristic is that they are braced between [ ] [caption id="attachment_2948" align="alignnone" width="480" caption="the caption goes here"] How could I remove those? (replace by nothing) I could also run a PHP program if necessary to do the cleanup.

    Read the article

  • How to replace {tag_INDEX} with array[INDEX] element

    - by ekapek
    Hi, I have string like this; "String {tag_0} text {tag_2} and {tag_1}" Now i need to replace all {tag_INDEX} with elements from array $myArray = array('a','b','c'); so after replacement it should looks like: "String a text c and b" What is the best way to do this? I'm trying with preg_replace and preg_replace_callback but without any good results

    Read the article

  • replace NA in an R vector with adjacent values

    - by pssguy
    I have a dataframe which has merged player and team data for soccer seasons So for a particular player in a specific season I have data like df <- data.frame(team=c(NA,"CRP",NA,"CRP","CRP",NA), player=c(NA,"Ed",NA,"Ed","Ed",NA), playerGame= c(NA,1,NA,2,3,NA), teamGame =c(1,2,3,4,5,6)) Where the NA's indicate that the player did not appear in that specific team game How would I most efficiently replace the team and player NA's with "CRP" and "Ed" respectively and have a plGame output of, in this instance, 0,1,1,2,3,3

    Read the article

  • String replace for personalize code generator

    - by Xurxof
    I must do a automatic codes generator with user-configurable string with predefined keys and can not find a good way to do it. For example, a string OT-{CustomCode}-{Date}-{##} could generate codes OT-C0001-20100420-01 OT-C0001-20100420-02 I thought of using RegExpr.Replace(), but I would have problems if the code of a customer was {##} Any help is welcome! (and sorry for my english)

    Read the article

  • How to program a text search and replace in PDF files

    - by rpilkey
    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, which works manually, but I don't want to modify 1300 files manually.

    Read the article

  • Replace BIT values with some text

    - by nihi_l_ist
    I have a BIT column with gender (0,1) and want to replace 0 and 1 in the resulting view with the words "man" and "woman". Can i do this right in the view with some system finction or i have to write my own function to do that?

    Read the article

  • multi_index composite_key replace with iterator

    - by Rohit
    Is there anyway to loop through an index in a boost::multi_index and perform a replace? #include <iostream> #include <string> #include <boost/multi_index_container.hpp> #include <boost/multi_index/composite_key.hpp> #include <boost/multi_index/member.hpp> #include <boost/multi_index/ordered_index.hpp> using namespace boost::multi_index; using namespace std; struct name_record { public: name_record(string given_name_,string family_name_,string other_name_) { given_name=given_name_; family_name=family_name_; other_name=other_name_; } string given_name; string family_name; string other_name; string get_name() const { return given_name + " " + family_name + " " + other_name; } void setnew(string chg) { given_name = given_name + chg; family_name = family_name + chg; } }; struct NameIndex{}; typedef multi_index_container< name_record, indexed_by< ordered_non_unique< tag<NameIndex>, composite_key < name_record, BOOST_MULTI_INDEX_MEMBER(name_record,string, name_record::given_name), BOOST_MULTI_INDEX_MEMBER(name_record,string, name_record::family_name) > > > > name_record_set; typedef boost::multi_index::index<name_record_set,NameIndex>::type::iterator IteratorType; typedef boost::multi_index::index<name_record_set,NameIndex>::type NameIndexType; void printContainer(name_record_set & ns) { cout << endl << "PrintContainer" << endl << "-------------" << endl; IteratorType it1 = ns.begin(); IteratorType it2 = ns.end (); while (it1 != it2) { cout<<it1->get_name()<<endl; it1++; } cout << "--------------" << endl << endl; } void modifyContainer(name_record_set & ns) { cout << endl << "ModifyContainer" << endl << "-------------" << endl; IteratorType it3; IteratorType it4; NameIndexType & idx1 = ns.get<NameIndex>(); IteratorType it1 = idx1.begin(); IteratorType it2 = idx1.end(); while (it1 != it2) { cout<<it1->get_name()<<endl; name_record nr = *it1; nr.setnew("_CHG"); bool res = idx1.replace(it1,nr); cout << "result is: " << res << endl; it1++; } cout << "--------------" << endl << endl; } int main() { name_record_set ns; ns.insert( name_record("Joe","Smith","ENTRY1") ); ns.insert( name_record("Robert","Brown","ENTRY2") ); ns.insert( name_record("Robert","Nightingale","ENTRY3") ); ns.insert( name_record("Marc","Tuxedo","ENTRY4") ); printContainer (ns); modifyContainer (ns); printContainer (ns); return 0; } PrintContainer ------------- Joe Smith ENTRY1 Marc Tuxedo ENTRY4 Robert Brown ENTRY2 Robert Nightingale ENTRY3 -------------- ModifyContainer ------------- Joe Smith ENTRY1 result is: 1 Marc Tuxedo ENTRY4 result is: 1 Robert Brown ENTRY2 result is: 1 -------------- PrintContainer ------------- Joe_CHG Smith_CHG ENTRY1 Marc_CHG Tuxedo_CHG ENTRY4 Robert Nightingale ENTRY3 Robert_CHG Brown_CHG ENTRY2 --------------

    Read the article

  • URL regex search and replace on MySQL (in WordPress)

    - by Tal Galili
    Hello all, I have a WordPress blog with numerous URL's I wish to replace from this: http://www.oldwebsite.co.il/name/*.asp To this: http://www.newwebsite.com/?p=* For example, from this: http://oldwebsite.co.il/name/65971.asp To this: http://www.newwebsite.com/?p=65971 I believe the following plugin: http://urbangiraffe.com/plugins/search-regex/ will do the trick with regex, but I am looking for the correct regex to use here. I found this stackoverflow thread that has a similar task, but since I am not too apt with regex, I was hoping for help so I don't mess anything up. Thanks, Tal After searching stackoverflow, I found

    Read the article

  • Using Regex.Replace() to replace text in a string

    - by aspdotnetuser
    Hi, I want to use Regex.Replace() to loop through a string containing words that are separated by '//' to check if any of the words match a string value which has been passed to the method. Here's my code at the moment: public void CheckText(string text) { //Check text entered by user string wordList = "word1//word2//word3 etc..."; string replaceString = "matched"; if (!string.IsNullOrEmpty(wordList)) { return Regex.Replace(text, wordList); //How do I implement this part? } } Please could someone help me with this? Any help/comments will be appreciated! Thanks,

    Read the article

  • python search replace using wildcards

    - by tom smith
    hi somewhat confused.. but trying to do a search/repace using wildcards if i have something like: <blah.... ssf ff> <bl.... ssf dfggg ff> <b.... ssf ghhjj fhf> and i want to replace all of the above strings with say, <hh >t any thoughts/comments on how this can be accomplished? thanks update (thanks for the comments!) i'm missing something... my initial sample text are: Soo Choi</span>LONGEDITBOX">Apryl Berney Soo Choi</span>LONGEDITBOX">Joel Franks Joel Franks</span>GEDITBOX">Alexander Yamato and i'm trying to get Soo Choi foo Apryl Berney Soo Choi foo Joel Franks Joel Franks foo Alexander Yamato i've tried derivations of name=re.sub("</s[^>]*\">"," foo ",name) but i'm missing something... thoughts... thanks

    Read the article

  • Regular Expression (preg_match_all)

    - by Helena
    This is my code: <?php $matchWith = "http://videosite.com/ID123"; preg_match_all('\S/videosite\.com\/(\w+)\S/i', $matchWith, $matches); foreach($matches[1] as $value) { print '<a href="http://videosite.com/'.$value.'"> Hyperlink </a>'; } ?> It's not working. I want to exclude every match that has a whitespace before or after the Link (with the ID). I used \S for this. For example if: $matchWith = " http://videosite.com/ID123 "; it should not display anything. Thank you.

    Read the article

  • Use regular expressions to match an ? but not a \?

    - by J.Milly
    I have a PHP regular expression that has been functioning fairly well to parse some odd legacy client templates until recently when we found an escaped question mark (\?) included in a template expression. I'm not strong enough with my regular expression-fu to wrap my feeble noodle around a negative look ahead or some techno-mumbo-jumbo so, tips or points in the right direction would be greatly appreciated. My PHP: preg_match_all("/\{\{IF (.*)\?(.*):(.*)\}\}/U", $template, $m, PREG_SET_ORDER);

    Read the article

  • php - preg_replace not working when string contains a hashtag

    - by Steven
    I found a function online for turning a url within a string into a clickable link. However, when the url contains a hashtag it doesn't work. eg. http://www.bbc.co.uk/radio1/photos/fearnecotton/5759/1#gallery5759 Here's the part of the function concerned: $ret = preg_replace( "#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret ); $ret = preg_replace( "#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret ); Any ideas? thanks

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >