Regular Expressions In Dreamweaver

Hi i am using Dreamweaver CS3, i am creating more than 100 HTML files every couple of days and need to use the regular Expressions Feature in the Find and Replace box but couldn't find or generate the expression i am looking For, i want to Replace every images name to be same as it's htm file name across all htm Files.
Ex : cieg.htm
<tr>
    <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><img src="Viva/XXXthefilenameXXX_38.gif" width="213" height="88"></td>
          <td><img src="Viva/XXXthefilenameXXX_39.gif" width="212" height="88"></td>
          <td><img src="Viva/XXXthefilenameXXX_40.gif" width="213" height="88"></td>
          <td><img src="Viva/XXXthefilenameXXX_41.gif" width="212" height="88"></td>
        </tr>
      </table></td>
  </tr>
and replace it to be:
<tr>
    <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><img src="Viva/cieg_38.gif" width="213" height="88"></td>
          <td><img src="Viva/cieg_39.gif" width="212" height="88"></td>
          <td><img src="Viva/cieg_40.gif" width="213" height="88"></td>
          <td><img src="Viva/cieg_41.gif" width="212" height="88"></td>
        </tr>
      </table></td>
  </tr>
and same as another htm file named zsac.htm
Any one knows a way to do it???
Regards

You will not see sql with asp when using view source and the
like. The
server executes the query and send the results. You need to
have
access to the source documents.

Similar Messages

  • Regular Expression For Dreamweaver

    I still haven't had the time to really become a professional when it comes to regular expressions, and sadly I am in need of one an finding it difficult to wrap my head around.
    In a text file I have hundreds of instances like the following:
    {Click here to visit my website}{http://www.adobe.com/}
    I need a regular expression for Dreamweaver that I can run within the "Find and Replace" window to switch the order of the above elements to:
    {http://www.adobe.com/}{Click here to visit my website}
    Can anyone provide some guidance? I'm coming up short due to my lack of experience with regular expressions.
    Thank you in advance!

    So you have a string that starts { and goes until the first }.  Then you have another string exactly the same.  And you want to swap them.  I'm not making any assumption that the second one has to look like a URL (that's a whole other minefield, but perhaps you could do something simple like it must start with http). 
    You don't specify how your text file is divided up, have you got this as a complete line to itself, or is it just  a huge block of text?  Preferably as individual lines.
    I don't have Dreamweaver, but this worked for me in Notepad++
    Find: ^{(.*?)}{(.*?)}$
    Replace with: {\2}{\1}
    My file looked like this:
    {Click here to visit my website}{http://www.adobe.com/}
    {some other site}{http://www.example.com/foo}
    And doing a Replace All ended up like this:
    {http://www.adobe.com/}{Click here to visit my website}
    {http://www.example.com/foo}{some other site}

  • BUG?? Syntax Highlighting Regular Expressions

    I'm working on a rather long regular expression in
    dreamweaver code view. It has about 200+ characters in it.
    I wrote it in another application and copied it over for use
    in js, and it wouldn't highlight correctly (sort of like when you
    leave off quote on a string). Naturally I thought I screwed up my
    regexp or forgot to escape a character or something so I went
    through it re-writing it and checking everything but it was
    correct. I saved the page and ran it in the browser and sure enough
    it worked.
    So I started typing the regexp from scratch this time in
    dreamweaver to see when it stopped highlighting correctly. It
    stopped at exactly 100 characters including opening and closing
    forward slashes. I tried writing another exp this time filled with
    just one letter. Again 100 characters exactly - not one more.
    Example:
    var reg1 =
    /ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss ssssssssss/
    var reg2 =
    /ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss sssssssssss/
    reg1 will highlight correctly, while reg2 won't.
    Is this a bug or am I missing something? The highlight rule
    (in Configuration\CodeColoring\CodeColoring.xml) is
    (\s*/\e*\\/
    -or-
    =\s*/ \e*\\ /
    There seems to be no limitation to length there.
    While this is not a huge deal, I might as was well be coding
    in notepad (or my other script editors which highlight this
    correctly) because the highlighting is worthless from this point
    on.
    I could make these strings instead of literals but I have a
    lot of these long expressions and would rather not go through them
    and escape all of my back slashes (there are tons) as well as
    quotes - and make them more un-maintainable as they already are.
    Anyone have this problem? Or a solution to it?

    random_acts wrote:
    > I'm working on a rather long regular expression in
    dreamweaver code view. It
    > has about 200+ characters in it.
    I have never written a regex as long as that, but was
    fascinated by your
    question, so attempted to replicate your problem.
    I gave up at 614 characters, but the syntax coloring didn't.
    I suggest
    that you submit a bug report with the details of your actual
    code:
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Match beginning of line with Regular Expression

    I'm confused about dreamweaver's treatment of the characters
    ^ and $ (beginning of line, end of line) in regex searches. It
    seems that these characters match the beginning of the file, not
    the beginning of the various lines in the file. I would expect it
    to work the other way around. A search like:
    (^.)
    should match every line in the file, so that a find/replace
    could be performed at the beginning of each line, like this:
    HELLO$1
    which would add 'HELLO' at the start of each line in the
    file.
    Instead, this action only matches the first character of the
    file, sticks 'HELLO' in front of it, and then quits (or moves on to
    the next file). The endline character $ behaves in a similar
    fashion, matching only the end of the file, not the end of each
    line.
    I've searched, and all the literature about regular
    expressions in dreamweaver seems to indicate that I'm expecting the
    correct behavior:
    www.adobe.com/devnet/dreamweaver/articles/regular_expressions_03.html
    quote:
    ^ Beginning of input or line ^T matches "T" in "This good
    earth" but not in "Uncle Tom's Cabin"
    $ End of input or line h$ matches "h" in "teach" but not in
    "teacher"
    Thanks for any insight, folks.

    Hi Winston,
    I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
    It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
    Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
    o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
    Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
    \\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
    Many thanks,
    Jack

  • Regular Expressions - Problem

    Hi @ all,
    I need a complicate regular expression, I don´t know.
    I have a big folder with many .htm pages (800-1000) and I have to do the following:
    http://www.domain.de/ab%32-xyz?myshop=123
    I have to delete the "ab%32-xyz", the problem is, that in this are, there could be every symbol, letter or number.
    So the area between "http://www.domain.de/" and "?myshop=123" (these 2 areas are everytime identical in all documents) shoud be deleted.
    Could everyone say me, how to do this with regular expressions in dreamweaver?
    Thanks,
    Felix
    P.S.: Sorry, my Engish is not so good, I´m from Germany

    Do you want to replace the random text with anything?
    If not, this is how you do it in DW:
    Make a backup of the folder you want to edit, just in case anything goes wrong
    Edit > Find and Replace
    In the Find and Replace dialog box, select Folder from the "Find in" drop-down menu, and select the folder you want to work with.
    Select Source Code from the Search drop-down menu.
    Put the following code in the Find text area:
    (http://www\.domain\.de/)[^?]+(\?myshop=123)
    Put the following code in the Replace text area:
    $1$2
    In Options, select the "Use regular expression" check box.
    Click Replace All. Dreamweaver will warn you that the operation cannot be undone in pages that aren't currently open. As long as you have made a backup, click OK to perform the operation.

  • Combine 2 or more regular expressions

    Hello
    I would like to ask, if it is possible to combine more search and replace regular expressions in dreamweaver (direct input or combining .drw files)
    for example, something easy:
    search: Adobe
    replace: $1&reg;
    and in same step also:
    search: euro; ([0-9])([0-9])([0-9])([0-9]),([0-9])([0-9])
    replace: euro; $1.$2$3$4,$5$6
    I would like to speed up my work and instead of 3 searc&replaces use only one.
    Thanks for your help

    st3n wrote:
    I would like to ask, if it is possible to combine more search and replace regular expressions in dreamweaver (direct input or combining .drw files)
    No. Although it's possible to combine the regular expressions to search for the different values, there's only one replacement value. Using your example would not only add &reg; after Adobe, but also in front of euro;. Under the hood, Dreamweaver is simply using the JavaScript replace() method.
    By the way, your second regex could be simplified like this:
    search: (euro; \d)(\d{3},\d{2})
    replace: $1.$2

  • Non-greedy regular expression search/replace

    i want to be able to do non-greedy regular expressions as
    dreamweaver defaults to greedy and eats all of the match it can
    match.
    Is there an add-on to add a checkbox or soemthing in the
    Search and Replace Dialog for non-greedyness?
    i guess i could throw something in there to match some simple
    expressions like...
    text to search n' replace:
    $Query .= ", dateReceived='".addslashes($dateReceived)."'" .
    ", dateReleased='".addslashes($dateReleased)."'";
    Instead of using this now
    Find: '"\.addslashes\(\$([^\)]*)\)\."'
    Replace: ". dateInsert($$1) ."
    i want to just use this wihout it getting greedy with the .*
    Find: '"\.addslashes\(\$(.*)\)\."'
    Replace: ". dateInsert($$1) ."

    In regular expression, if you want the .* to not be greedy
    you add a '?' after so yo you have '.*?'
    Find: '".addslashes($dateReleased)."'
    Hope that help,
    Chris
    Adobe Dreamweaver Engineering

  • Regular Expressions Help in Dreamweaver

    Hi i am using Dreamweaver CS3, i am creating more than 100 HTML files every couple of days and need to use the regular Expressions Feature in the Find and Replace box but couldn't find or generate the expression i am looking For, i want to Replace every images name to be same as it's htm file name across all htm Files.
    Ex : cieg.htm
    <tr>
        <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="Viva/XXXthefilenameXXX_38.gif" width="213" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_39.gif" width="212" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_40.gif" width="213" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_41.gif" width="212" height="88"></td>
            </tr>
          </table></td>
      </tr>
    and replace it to be:
    <tr>
        <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="Viva/cieg_38.gif" width="213" height="88"></td>
              <td><img src="Viva/cieg_39.gif" width="212" height="88"></td>
              <td><img src="Viva/cieg_40.gif" width="213" height="88"></td>
              <td><img src="Viva/cieg_41.gif" width="212" height="88"></td>
            </tr>
          </table></td>
      </tr>
    and same as another htm file named zsac.htm
    Any one knows a way to do it???
    Regards

    Dreamweaver's Find and Replace can't use the filename automatically. You would need to do it separately for each page. However, the following regular expression should speed up the process on individual pages:
    Find in: Current Document
    Search: Source Code
    Find:
    (<img src="Viva/)[\w]+(\d{2}.gif")
    Replace
    $1cieg_$2
    In other words, you need to add "cieg" or the name of the file between $1 and _$2.
    [Edited by DP to correct error in first sentence. DW cannot use the filename automatically.]

  • The Regular Expression anchors, "^" and "$" do not work for me in Dreamweaver

    I am using the Find and Replace feature of Dreamweaver 8 and especially the "Use Regular Expressions" setting.  But I have never been able to make the Regular Expression anchors "^" and "$" work at all.  This are supposed to fix a match at the beginning or ending of a line or input.  But if I search even something as elementary as "^ ", or " $", it can't seem to find them.
    Am I missing something?  Can somebody give me an example of this working?
    Any and all tips or clues would be appreciated.

    Welcome to Apple Discussions and Mac Computing
    Definitely an E-bay issue. The coding on the page is not Safari-friendly. Firefox, as you discovered, in this instance is the better choice.

  • How can I remove all content between two tags using Find/Replace regular expressions?

    This one is driving me bonkers...  I'm relatively new to regular expressions, but I'm trying to get Dreamweaver to remove all content between two tags in an XML document.  For example, let's say I have the following XML:
    <custom>
    <![CDATA[<p>Some text</p>
    <p>Some more text</p>]]>
    </custom>
    I'd like to do a Find/Replace that produces:
    <custom>
    </custom>
    In essence, I'd like to strip all of the content between two tags.  Ideally, I'd like to know how to strip the CDATA content as well, to return the following:
    <custom>
    <![CDATA[]]>
    </custom>
    I'd much appreciate any suggestions on accomplishing this.
    Many thanks!

    Thanks much for your response.  I found David's article to be a little thin with respect to examples using quantifiers in coordination with the wildcard metacharacters; however, I was able to cobble together a working expression through trial and error using the information he presented.  For posterity, here’s the solution:
    Find:
    <custom>[\d\D]*?</custom>
    Replace:
    <custom>
    <![CDATA[]]>
    </custom>
    I believe this literally translates to:
    [] = find anything in this range/character class
    \d = find any digit character (i.e. any number)
    \D = find any non-digit character (i.e. anything except numbers)
    *? = match zero or more times, but as few times as possible (i.e. match multiple characters per instance, but only match one instance at a time, or none at all)
    I’m still not sure how to effectively utilize the . wildcard.  For example, the following expression will not find content that ends with a number:
    <custom>.*?[\D]*?</ custom >
    I'm presuming this is because numbers aren't included in the \D metacharacter; however, shouldn't numbers be picked up by the .*? expression?

  • Using regular expressions to find and replace code.

    Hi! Semi-newbie coder here.
    I'm trying to strip out code from multiple pages, I've tried regular expressions but I'm struggling to understand them. I also need to do it across a LOT of pages, so I need an automated way of doing it.
    The best way I can explain is with an analogy:
    I want to delete any string of characters that start with c, ends with t and includes anything inbetween, so it would pick up "cat, cut, chat, coconut, can do it" whatever appears in the middle of those.
    Except, instead of c and t, I want it to find strings of code starting with <div class="advert" and ending with Vote<br> while picking up everything in between, (including spaces, code, comments, etc.). Then, deletes that whole string including the starting and ending.Is there a regular expression I could use in dreamweaver that could do this? Is there a way to do this at all?

    Let me begin by saying I'm a complete idiot with DW's Reg Ex.   I use Search Specific Tag whenever possible.  See screenshot below.
    Try this on your Current Document to see if it works. Then make a back-up copy of site before attempting it on Entire Local Site as you cannot "Undo" this process.
    Good luck,
    Nancy O.

  • "Multiple Line" Regular expressions in find/replace

    Hi there,
    I'm wondering if it is possible to find and replace (in batch
    mode) the following obstacle:
    say is have this piece of code in every html file i'd like to
    edit:
    <html>
    <blah blah (Same text in all files)>
    <blah blah (NOT same text in all files)>
    <blah blah (NOT same text in all files)>
    <code that is the same again in all files>
    and would like to replace it by nothing, effectively deleting
    the part completely... (by leaving the replace by field empty).
    The tricky part is that the lines which are NOT the same in
    all files, are sometimes 2 lines, but sometimes 3 or more lines.
    Somehow I need to get the regular expression to include
    <line>* (or something similar), in order to make the regular
    expression work.
    Any ideas on how to solve this? I must say untill now, the
    Dreamweaver search and replace function has been the most effective
    one, compared to many alternatives out there.
    Rp

    I've tried \1 and $1Just these in the text items of the find & replace dialog box...?????
    Can you write down exactly what have you tried....(text to be replaced by which....)????
    Greetings....
    Sim

  • [DW CC] Regular Expression and Back Reference in "Replace with": Escape

    I have a problem with escaping a character in "Replace with".
    Let's assume the following situation:
    Content:
    foobar
    Search for:
    (foo)(bar)
    Replace by:
    $1zot$2
    Result:
    foozotbar
    Everything is fine.
    But I want to insert the number "2" in between foo and bar.
    When I use
    Replace by: $12$2
    The result is:
    $12$2
    It seems that the regex engine interpretes the "$12" as a whole. And because there's no back reference with the count "12" DW cannot work correctly.
    The question:
    How can I "escape" the "2"?
    Thanks.

    Dreamweaver uses JavaScript for its Find and Replace with regex.
    I've just checked the Regular Expressions Cookbook by Jan Goyvaerts and Steven Levithan (O'Reilly). It deals with exactly this sort of situation where capturing groups can be ambiguous. This is what it says:
    "Java and JavaScript try to be clever with $10 [and above]. If a capturing group with the two-digit number exists in your regular expresssion, both digits are used for the capturing group. If fewer capturing groups exist, only the first digit is used to reference the group, leaving the second as a literal. Thus $23 is the 23rd capturing group, if it exists. Otherwise, it is the second capturing group followed by a literal 3."
    In other words, there is no way to escape the 2 in the Replace field. It would appear there's a bug in Dreamweaver's use of capturing groups.

  • Regular Expressions - Removing a Timestamp?

    I have hundreds of plain HTML pages. I'd like to remove the
    timestamp from them, which looks like this:
    [19:45]
    I've tried using the wildcard feature, but the problem is is
    that I want the BRACKETS gone, as well. Unfortunately, I've only
    succeeded in removing either the last bracket (with the open
    bracket and time still intact) or all of my data completely. How
    can I successfully delete the varying times and their brackets
    without touching the rest of my data?

    In Find/Replace, with Use Regular Expression turned on:
    Find:
    \[\d\d?:\d\d?\]
    Replace:
    (leave it blank)
    E. Michael Brandt
    www.divahtml.com
    www.divahtml.com/products/scripts_dreamweaver_extensions.php
    Standards-compliant scripts and Dreamweaver Extensions
    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, et alia

  • PHP Regular Expressions

    I am trying to write a script that searches for image tags
    and checks for alt tags within them. I am using preg_match_all to
    find all the img tags but i am messing up somewhere on my regular
    expression pattern.
    I seriously just started learning these expressions days ago
    so i really do not know what i am doing here. For some reason my
    current expression: /<img.+\/>./ Doesnt find the next >
    after finding the first <img tag. It gets like the second or
    third one. Shouldnt it cut it off after it finds the first >?
    In addition, my other expression (for extracgting the src tag
    doesnt stop after the second quatation. Insead it goes for a few
    more. /src=\".*\"/ is what i have now.
    What do i need to fix so that the results i get back dont
    include anything after the first > or the second quation
    mark?

    barbedwire103 wrote:
    > What do i need to fix so that the results i get back
    dont include anything
    > after the first > or the second quation mark?
    /<img[^>]+>/
    /src\s?=\s?"[^"]+"/
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for