Search and Replace Question

Ask a Question related to Macromedia Dreamweaver, Design and Development.

  1. #1

    Default Search and Replace Question

    Hi,

    Is it possible to (and if yes how) to find all instance of
    a string similar to this:

    height=34

    and have dreamweaver replace it with

    height="34"

    I know about the RegExp in search and replace and have already
    tried using a search on height=\d* to find all the matching strings,
    but I can't figure out how to automatically add the quotes...(height="\d*"
    didn't work)

    Thanks for your help!

    Laurent


    DareDevil Guest

  2. Similar Questions and Discussions

    1. Search and replace
      I'm certain this has been asked 1000 times.. however ... I recently imported some data - all INTs ... from an excel sheet, but the damn thing...
    2. Search and replace weirdness
      I have just completed an office layout plan for a new building. The plan shows some 200 offices and each office has a number containing several zeros...
    3. Search and replace (super global replace)
      I am using the 30 day trail of acrobate professional....before I buy it I have a few questions.... 1) is there a "search and replace" function...
    4. search an replace
      Hi This scripts sucks in a 109mb file and i'm trying to do a search and replace on unxtime to the format from strftime. Which is working... ...
    5. search replace
      Hi , How do I search replace text in a file from a perl script. i.e. by opening the file in write mode and then do a search replace. I don't...
  3. #2

    Default Re: Search and Replace Question

    hi,

    yes, it's possible. go to Edit > Find And Replace. Or press CTRL+F and it
    should open a dialog for you..

    -ville

    DareDevil wrote:
    > Hi,
    >
    > Is it possible to (and if yes how) to find all instance of
    > a string similar to this:
    >
    > height=34
    >
    > and have dreamweaver replace it with
    >
    > height="34"
    >
    > I know about the RegExp in search and replace and have already
    > tried using a search on height=\d* to find all the matching strings,
    > but I can't figure out how to automatically add the quotes...(height="\d*"
    > didn't work)
    >
    > Thanks for your help!
    >
    > Laurent
    >
    >
    Ville Leivo Guest

  4. #3

    Default Re: Search and Replace Question

    Yes I know that...
    I'd like to find a way to have dreamweaver replace all height=<any number>
    by
    height="<any number>"

    I used height=34 only as an example...

    Thanks


    "Ville Leivo" <ville.leivo@kolumbus.fi> wrote in message
    news:3F1CD6B5.2080301@kolumbus.fi...
    > hi,
    >
    > yes, it's possible. go to Edit > Find And Replace. Or press CTRL+F and it
    > should open a dialog for you..
    >
    > -ville
    >
    > DareDevil wrote:
    > > Hi,
    > >
    > > Is it possible to (and if yes how) to find all instance of
    > > a string similar to this:
    > >
    > > height=34
    > >
    > > and have dreamweaver replace it with
    > >
    > > height="34"
    > >
    > > I know about the RegExp in search and replace and have already
    > > tried using a search on height=\d* to find all the matching strings,
    > > but I can't figure out how to automatically add the
    quotes...(height="\d*"
    > > didn't work)
    > >
    > > Thanks for your help!
    > >
    > > Laurent
    > >
    > >
    >

    DareDevil Guest

  5. #4

    Default Re: Search and Replace Question

    what about pressing "replace all"?

    Search for "Source code": height=34
    Replace with: height="34"

    and then press "R
    eplace all".

    -ville

    DareDevil wrote:
    > Yes I know that...
    > I'd like to find a way to have dreamweaver replace all height=<any number>
    > by
    > height="<any number>"
    >
    > I used height=34 only as an example...
    >
    > Thanks
    >
    >
    > "Ville Leivo" <ville.leivo@kolumbus.fi> wrote in message
    > news:3F1CD6B5.2080301@kolumbus.fi...
    >
    >>hi,
    >>
    >>yes, it's possible. go to Edit > Find And Replace. Or press CTRL+F and it
    >>should open a dialog for you..
    >>
    >>-ville
    >>
    >>DareDevil wrote:
    >>
    >>>Hi,
    >>>
    >>>Is it possible to (and if yes how) to find all instance of
    >>>a string similar to this:
    >>>
    >>>height=34
    >>>
    >>>and have dreamweaver replace it with
    >>>
    >>>height="34"
    >>>
    >>>I know about the RegExp in search and replace and have already
    >>>tried using a search on height=\d* to find all the matching strings,
    >>>but I can't figure out how to automatically add the
    >>
    > quotes...(height="\d*"
    >
    >>>didn't work)
    >>>
    >>>Thanks for your help!
    >>>
    >>>Laurent
    >>>
    >>>
    >>
    >
    >
    Ville Leivo Guest

  6. #5

    Default Re: Search and Replace Question

    try this on a page- but backup first, it's late here

    Find in Source: Specific Tag-->IMG
    With: Attribute-->Width= (\d*)

    Action: Set Attribute Width= "$1"

    Put checkmark in "use RegExp"

    --
    Team Macromedia Volunteer for Dreamweaver
    Certified Dreamweaver MX Developer

    Alan Ames Guest

  7. #6

    Default Search and Replace question

    Hi

    I am trying to do some thing like this, but am getting the wrong output. Can
    somebody tell if my regular expression is wrong or not?

    ---------Perl script---------------------------------------
    $line = "ABCXYZGwcTI\\ABCXYZIntValTI";

    $line=~s/ABCXYZ(.*)TI/Hello$1/g;
    print $line;
    ---------Output---------------------------------------
    HelloGwcTI\\ABCXYZIntVal
    ---------Expected Output-------------------------
    HelloGwc\\HelloIntVal
    ----------------------------------------------------------
    Thanks in Adcance
    Saju

    __________________________________________________ _______________
    Tired of slow downloads and busy signals? Get a high-speed Internet
    connection! Comparison-shop your local high-speed providers here.
    [url]https://broadband.msn.com[/url]

    Saju Palayur Guest

  8. #7

    Default Re: Search and Replace question

    Saju Palayur wrote:
    > Hi
    >
    > I am trying to do some thing like this, but am getting the wrong output.
    > Can somebody tell if my regular expression is wrong or not?
    >
    > ---------Perl script---------------------------------------
    > $line = "ABCXYZGwcTI\\ABCXYZIntValTI";
    >
    > $line=~s/ABCXYZ(.*)TI/Hello$1/g;
    > print $line;
    > ---------Output---------------------------------------
    > HelloGwcTI\\ABCXYZIntVal
    that's not the output of the above script. you shouldn't see '\\', there
    should be just one. the other one is long gone from the double quote. next
    time you post, you should be more careful to provide the correct output of
    your script as to avoid confusion.
    > ---------Expected Output-------------------------
    > HelloGwc\\HelloIntVal
    > ----------------------------------------------------------
    again, i assume you mean: "HelloGwc\HelloIntVal"

    the reason is because (.*) is greedy and matching from the first 'G' up to
    the last 'l'. you need to stop the greedy-ness (.*) like:

    #!/usr/bin/perl -w
    use strict;

    my $line1 = "ABCXYZGwcTI\\ABCXYZIntValTI";
    my $line2 = $line1;

    #--
    #-- for your purpose, you can use either one of followings
    #--
    $line1 =~ s/ABCXYZ(.+?)TI/Hello$1/g;
    $line2 =~ s/ABCXYZ(.*?)TI/Hello$1/g;

    print $line1,"\n";
    print $line2,"\n";

    __END__

    prints:

    HelloGwc\HelloIntVal
    HelloGwc\HelloIntVal

    david
    --
    s,.*,<<,e,y,\n,,d,y,.s,10,,s
    ..ss.s.s...s.s....ss.....s.ss
    s.sssss.sssss...s...s..s....
    ....s.ss..s.sss..ss.s....ss.s
    s.sssss.s.ssss..ss.s....ss.s
    ...s..sss.sssss.ss.sss..ssss.
    ...sss....s.s....ss.s....ss.s

    ,....{4},"|?{*=}_'y!'+0!$&;"
    ,ge,y,!#:$_(-*[./<-@{-},b-t,
    ..y...,$~=q~=?,;^_#+?{~,,$~=~
    y.!-&*-/:-@^_{}.a-t ().;s,;,
    );,g,s,s,$~s,g,y,y,%,,g,eval
    David Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139