www.webdeveloper.com
Results 1 to 2 of 2

Thread: text removal

  1. #1
    Join Date
    Jun 2007
    Posts
    15

    text removal

    I need to check for every line of code in an .asp file and remove or replace specific text. i am using this but only works for a specific portion of the code. the .asp file is being generated from an xml file. i want to check each line of the asp page code.


    my $a_file='';
    $a_file=XML_value('XML.Banner');
    $a_file=~ s/\/text_toRemove\///;

  2. #2
    Join Date
    Oct 2007
    Location
    Vienna, Austria
    Posts
    389
    Just add the "g" modifier to say that you want global replacement. This only replaces the first occurrence of /text_to_remove/.

    $a_file =~ s/\/text_toRemove\///g;

    And if there are slashes in your pattern, it's more elegant to use a different separator than a slash:

    $a_file =~ s{/text_toRemove/}{}g;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles