Search Results

Search found 9447 results on 378 pages for 'str replace'.

Page 20/378 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • XML Node replacement in Actionscript 3

    - by Andreas
    Hi, A couple of days ago I asked a question about how to replace and edit values in an xml file with c#. The question got a great answer. Now I wonder how to do this in Actionscript and if there is an as simple way as in c#. The question can be found here: http://stackoverflow.com/questions/2856459/advanced-replace-in-c Thanks

    Read the article

  • Replacing characters with specified one

    - by mahesh
    Hello All, I have a string as follows - MFMFMF now i want to change this string to FMFMFM how to do this , help needed pls i had tried select replace(replace('mfmfmf','M','F'),'F','M') this gives me result - MMMMMM which i donot what i want the output to be FMFMFM Need your help D.Mahesh

    Read the article

  • preg_replace not working for charachter \

    - by krike
    I'm trying to replace \' with ' but it won't work This is the text I want to replace from Using Twitter\'s @Anywhere Service in 6 Steps and this is the code $tutorial = "Using Twitter\'s @Anywhere Service in 6 Steps "; echo $tutorial."<br /><br />"; $tut_title = preg_replace("/\\'/", "'", $tutorial); echo $tut_title;

    Read the article

  • Multiple Regex on String

    - by George
    How can I apply multiple regexs to a single string? For instance, a user inputs the following into a text area: red bird blue cat black dog and I want to replace each carriage return with a comma and each space with an underscore so the final string reads as red_bird,blue_cat,black_dog. I've tried variations in syntax along the lines of the following so far: function formatTextArea() { var textString = document.getElementById('userinput').value; var formatText = textString.replace( new RegExp( "\\n", "g" ),",", new RegExp( "\\s", "g"),"_"); alert(formatText); }

    Read the article

  • Remove %20 from URL using jquery

    - by Pankaj
    hello all When i am trying to get query string value from URL using JQuery, It replace space to %20 for each 1 space.If there are 3space then my query string value contain %20 3times. i want to replace these %20 back with space using Jquery, so that i can use these query string value. How can i do this.

    Read the article

  • str_replace() and strpos() for arrays?

    - by Josh
    I'm working with an array of data that I've changed the names of some array keys, but I want the data to stay the same basically... Basically I want to be able to keep the data that's in the array stored in the DB, but I want to update the array key names associated with it. Previously the array would have looked like this: $var_opts['services'] = array('foo-1', 'foo-2', 'foo-3', 'foo-4'); Now the array keys are no longer prefixed with "foo", but rather with "bar" instead. So how can I update the array variable to get rid of the "foos" and replace with "bars" instead? Like so: $var_opts['services'] = array('bar-1', 'bar-2', 'bar-3', 'bar-4'); I'm already using if(isset($var_opts['services']['foo-1'])) { unset($var_opts['services']['foo-1']); } to get rid of the foos... I just need to figure out how to replace each foo with a bar. I thought I would use str_replace on the whole array, but to my dismay it only works on strings (go figure, heh) and not arrays.

    Read the article

  • Why can't I use accented characters next to a word boundary?

    - by Rexxars
    I'm trying to make a dynamic regex that matches a persons name. It works without problems on most names, until I ran into accented characters at the end of the name. Example: Some Fancy Namé The regex I've used so far is: /\b(Fancy Namé|Namé)\b/i Used like this: "Goal: Some Fancy Namé. Awesome.".replace(/\b(Fancy Namé|Namé)\b/i, '<a href="#">$1</a>'); This simply won't match. If I replace the é with a e, it matches just fine. If I try to match a name such as "Some Fancy Naméa", it works just fine. If I remove the word last word boundary anchor, it works just fine. Why doesn't the word boundary flag work here? Any suggestions on how I would get around this problem? I have concidered using something like this, but I'm not sure what the performance penalties would be like: "Some fancy namé. Allow me to ellaborate.".replace(/([\s.,!?])(fancy namé|namé)([\s.,!?]|$)/g, '$1<a href="#">$2</a>$3') Suggestions? Ideas?

    Read the article

  • (PHP) Validation, Security and Speed - Does my app have these?

    - by Devner
    Hi all, I am currently working on a building community website in PHP. This contains forms that a user can fill right from registration to lot of other functionality. I am not an Object-oriented guy, so I am using functions most of the time to handle my application. I know I have to learn OOPS, but currently need to develop this website and get it running soon. Anyway, here's a sample of what I let my app. do: Consider a page (register.php) that has a form where a user has 3 fields to fill up, say: First Name, Last Name and Email. Upon submission of this form, I want to validate the form and show the corresponding errors to the users: <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="name">Name:</label> <input type="text" name="name" id="name" /><br /> <label for="lname">Last Name:</label> <input type="text" name="lname" id="lname" /><br /> <label for="email">Email:</label> <input type="text" name="email" id="email" /><br /> <input type="submit" name="submit" id="submit" value="Submit" /> </form> This form will POST the info to the same page. So here's the code that will process the POST'ed info: <?php require("functions.php"); if( isset($_POST['submit']) ) { $errors = fn_register(); if( count($errors) ) { //Show error messages } else { //Send welcome mail to the user or do database stuff... } } ?> <?php //functions.php page: function sql_quote( $value ) { if( get_magic_quotes_gpc() ) { $value = stripslashes( $value ); } else { $value = addslashes( $value ); } if( function_exists( "mysql_real_escape_string" ) ) { $value = mysql_real_escape_string( $value ); } return $value; } function clean($str) { $str = strip_tags($str, '<br>,<br />'); $str = trim($str); $str = sql_quote($str); return $str; } foreach ($_POST as &$value) { if (!is_array($value)) { $value = clean($value); } else { clean($value); } } foreach ($_GET as &$value) { if (!is_array($value)) { $value = clean($value); } else { clean($value); } } function validate_name( $fld, $min, $max, $rule, $label ) { if( $rule == 'required' ) { if ( trim($fld) == '' ) { $str = "$label: Cannot be left blank."; return $str; } } if ( isset($fld) && trim($fld) != '' ) { if ( isset($fld) && $fld != '' && !preg_match("/^[a-zA-Z\ ]+$/", $fld)) { $str = "$label: Invalid characters used! Only Lowercase, Uppercase alphabets and Spaces are allowed"; } else if ( strlen($fld) < $min or strlen($fld) > $max ) { $curr_char = strlen($fld); $str = "$label: Must be atleast $min character &amp; less than $max char. Entered characters: $curr_char"; } else { $str = 0; } } else { $str = 0; } return $str; } function validate_email( $fld, $min, $max, $rule, $label ) { if( $rule == 'required' ) { if ( trim($fld) == '' ) { $str = "$label: Cannot be left blank."; return $str; } } if ( isset($fld) && trim($fld) != '' ) { if ( !eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $fld) ) { $str = "$label: Invalid format. Please check."; } else if ( strlen($fld) < $min or strlen($fld) > $max ) { $curr_char = strlen($fld); $str = "$label: Must be atleast $min character &amp; less than $max char. Entered characters: $curr_char"; } else { $str = 0; } } else { $str = 0; } return $str; } function val_rules( $str, $val_type, $rule='required' ){ switch ($val_type) { case 'name': $val = validate_name( $str, 3, 20, $rule, 'First Name'); break; case 'lname': $val = validate_name( $str, 10, 20, $rule, 'Last Name'); break; case 'email': $val = validate_email( $str, 10, 60, $rule, 'Email'); break; } return $val; } function fn_register() { $errors = array(); $val_name = val_rules( $_POST['name'], 'name' ); $val_lname = val_rules( $_POST['lname'], 'lname', 'optional' ); $val_email = val_rules( $_POST['email'], 'email' ); if ( $val_name != '0' ) { $errors['name'] = $val_name; } if ( $val_lname != '0' ) { $errors['lname'] = $val_lname; } if ( $val_email != '0' ) { $errors['email'] = $val_email; } return $errors; } //END of functions.php page ?> OK, now it might look like there's a lot, but lemme break it down target wise: 1. I wanted the foreach ($_POST as &$value) and foreach ($_GET as &$value) loops to loop through the received info from the user submission and strip/remove all malicious input. I am calling a function called clean on the input first to achieve the objective as stated above. This function will process each of the input, whether individual field values or even arrays and allow only tags and remove everything else. The rest of it is obvious. Once this happens, the new/cleaned values will be processed by the fn_register() function and based on the values returned after the validation, we get the corresponding errors or NULL values (as applicable). So here's my questions: 1. This pretty much makes me feel secure as I am forcing the user to correct malicious data and won't process the final data unless the errors are corrected. Am I correct? Does the method that I follow guarantee the speed (as I am using lots of functions and their corresponding calls)? The fields of a form differ and the minimum number of fields I may have at any given point of time in any form may be 3 and can go upto as high as 100 (or even more, I am not sure as the website is still being developed). Will having 100's of fields and their validation in the above way, reduce the speed of application (say upto half a million users are accessing the website at the same time?). What can I do to improve the speed and reduce function calls (if possible)? 3, Can I do something to improve the current ways of validation? I am holding off object oriented approach and using FILTERS in PHP for the later. So please, I request you all to suggest me way to improve/tweak the current ways and suggest me if the script is vulnerable or safe enough to be used in a Live production environment. If not, what I can do to be able to use it live? Thank you all in advance.

    Read the article

  • How to str_replace a section of PHP Code

    - by whatshakin
    $embedCode = <<<EOF getApplicationContent('video','player',array('id' => $iFileId, 'user' => $this->iViewer, 'password' => clear_xss($_COOKIE['memberPassword'])),true) EOF; $name = str_replace($embedCode,"test",$content); I'm trying to replace a section of code with another piece of code. I can do it with smaller strings but once I added the larger strings to $embedCode, it throw an "unexpected T_ENCAPSED_AND_WHITESPACE" error

    Read the article

  • Replace single file on tomcat-deployed war

    - by xain
    Hi, I'd like to know how to configure tomcat 6 in order to be able to replace a file from a war - for instance an image or a jsp - so I don't need to restart the server to keep it updated. I assume I'll have to deploy it as a directory - not just copying the war file to webapp ? Thanks.

    Read the article

  • Replace sound in another YouTube video

    - by Tom
    I have received permission from someone to translate the audio in their movies. The problem I am facing is that the video quality is quite poor and the author does not have the original videos any more. How can I replace the audio in the YouTube videos without further degrading the quality of the videos? Thanks, Tom

    Read the article

  • Replace clock battery on Dell Inspiron 8200?

    - by jacobsee
    I have an old Dell Inspiron 8200 laptop. Still mostly works, but the clock battery has died so everytime I power it on I need to go into the BIOS and set the proper clock time. From what I've been able to tell, replacing this battery is non-trivial, but I haven't found a clear answer. How do I replace the clock battery? And how do I buy a replacement?

    Read the article

  • searching for replace broken laptop screen

    - by eran
    hey, i have a laptop with 16'' wide screen, but the screen is broken and i want to buy only the screen and replace it.. my laptop is: HP Pavilion dv6-1050us what i know about the screen is that it's model number 512357-001 "16inch widescreen BrightView BV display panel IMR, with web camera and microphone". I did find some screen which seems to be the one but i'm not sure and dont want to spend money for the wrong screen, can any one help please? thanks, eran

    Read the article

  • Notepad++ Search & Replace with Regular Expressions

    - by Jeremy
    I know its simple, but I can't get it to work... I have a strings like {span style="display:none"}123{/span} and {span style="display:none"}456{/span} and {span style="display:none"}789{/span} in a file. I want to remove all of these string. So, I thought a simple regular expression replace in NotePad++ should be like "{span style="display:none"}[(.)]{/span}" - but, this is not working. Thank for your help!

    Read the article

  • Use sed command to replace , appearing between numbers

    - by Saurabh
    I have a CSV file where data are in the following format |001|,|abc,def|,123456,789,|aaa|,|bbb|,444,555,666 I want to replace only those "," that appears between numbers with some other character like say SOH or $ or * other "," appearing in the line should not get replaced i.e. to say I wish to have following output |001|,|abc,def|,123456*789,|aaa|,|bbb|,444*555*666 Can someone please help me with sed command pattern to get the above desired output

    Read the article

  • Adobe Dreamweaver CS5 Find and Replace ALT-F not working

    - by wag2639
    I'm using a demo of Adobe Dreamweaver CS5 and I've notice that they no longer open the Find and Replace in a separate window. The problem with this, at least on Windows 7, is that I can't use the normal hotkey shortcuts like ALT-F because its being intercepted by the main Window and brings up the file menu drop down. Is there a fix for this?

    Read the article

  • Replace, not merge, folders when copying

    - by Adam Kane
    In Windows Vista, when I try to move a folder to replace an existing folder, Vista asks me if I want to merge the folders or cancel. How do I get the old XP behavior where the old folder is just replaced. This issue is especially challenging when moving many folders at once and some of them move but then some of them hit this merge/cancel problem. Thanks!

    Read the article

  • Missing return statement when using .charAt [migrated]

    - by Timothy Butters
    I need to write a code that returns the number of vowels in a word, I keep getting an error in my code asking for a missing return statement. Any solutions please? :3 import java.util.*; public class vowels { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please type your name."); String name = input.nextLine(); System.out.println("Congratulations, your name has "+ countVowels(name) +" vowels."); } public static int countVowels(String str) { int count = 0; for (int i=0; i < str.length(); i++) { // char c = str.charAt(i); if (str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'o' || str.charAt(i) == 'i' || str.charAt(i) == 'u') count = count + 1; } } }

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >