RESOLVED: Understand regular expressions in search and replace - use it to replace everything between two comments

I solved this by using the following regular expression in find DW and replace dialogue, it will be all the html on several lines between two specified comments:

<!-NameofStartingComment--(.| \s)*?--NameofEndingComment-->)




Hello

I have structured my site in dreamweaver with each page between the comments section:

<! - navBarStart - >
HTML here
<! - naveBarEnd - >

I used this method because I wanted to be able to easily use the find and replace dialogue with regular expressions to update pieces of code throughout my site. However, I have real problems finding the correct regular expression to use.

So in every page I have my <! - startHtmlSection - > <!-endHtmlSection-> between these two tags, I sometimes have different HTML. I want to find the regular expression I could use 'generic' of all the html to a find a replacement between two of my comments specified. Can anyone help? I googled and tried everything what is obvious (after you have selected the regular expressions in the find and Replace dialog) but DW never find the tags in the pages of sites.

I solved this by using the following regular expression in find DW and replace dialogue, it will be all the html on several lines between two specified comments:

Hello

I have structured my site in dreamweaver with each page between the comments section:


HTML here

I used this method because I wanted to be able to easily use the find and replace dialogue with regular expressions to update pieces of code throughout my site. However, I have real problems finding the correct regular expression to use.

So in every page I have my between these two tags, I sometimes have different HTML. I want to find the regular expression I could use 'generic' of all the html to a find a replacement between two of my comments specified. Can anyone help? I googled and tried everything what is obvious (after you have selected the regular expressions in the find and Replace dialog) but DW never find the tags in the pages of sites.

Tags: Dreamweaver

Similar Questions

  • Regular expression help please. (extraction of a subset of the string between two markers)

    I haven't used regular expressions before, and I can't find a regular expression to extract a subset of the string between two markers.

    The chain;

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    6 ERRORS
                         
    Info I want to line 1
    Info I want line 2
    Info I want line 3
    Info I want to line 4
    Info I want to line 5
    Info I want line 6
    END_ERRORS

    From the string above (it is read from a text file), I try to extract the subset of string between ERRORS 6 and END_ERRORS. The number of errors (6 in this case) can be any number from 1 to 32, and the number of lines I want to extract will correspond with this number. I can provide this number of a caller VI if necessary.

    My current solution, which works, but is not very elegant;

    (1) using Match Regular Expression for the return of the string after you have synchronized the 6 ERRORS

    (2) uses the Regular Expression matches to return all characters before game END_ERRORS of the string returned by (1)

    Is there a way this can be accomplished using 1 Regular Expression Match? If so someone could suggest how, as well as an explanation of the work of the given regular expression.

    Thank you very much

    Alan

    I used a character class to catch any word or whitespace characters.  This put inside parentheses a substring matching the criteria that you can get by developing the node for regular expression matching.  The \d matches the numbers and the two * s repetition of the previous term.  So, \d* will find the '6', as well as "123456".

  • I can't seem to make the "search and replace string" works as expected.

    I tried to replace "^ []] +---+ ([^] +).» "$*" with $1 in "create table leq_octave_5min (recorded_time DATETIME CONSTRAINT pk1 PRIMARY KEY, leq5m leq5m of FLOAT CONSTRAINT NOT NULL, min min FLOAT CONSTRAINT NOT NULL, max max FLOAT CONSTRAINT NOT NULL, CONSTRAINT of FLOAT L05 05 NOT NULL, CONSTRAINT of FLOAT L10 10 NOT NULL, L50 FLOAT CONSTRAINT 50 NOT NULL, L90 FLOAT 90 CONSTRAINT NOT NULL. L95 FLOTTER CONSTRAINT 95 NON NULL, us01 us01 FLOAT CONSTRAINT NOT NULL, EN02 EN02 FLOTTER CONSTRAINT NOT NULL, fr03 FR03 FLOTTER CONSTRAINT NOT NULL, fr04 FR04 FLOTTER CONSTRAINT NOT NULL, fr05 FR05 FLOTTER CONSTRAINT NOT NULL, fr06 FR06 FLOTTER CONSTRAINT NOT NULL, fr07 FR07 FLOTTER CONSTRAINT NOT NULL, fr08 FR08 FLOTTER CONSTRAINT NOT NULL, fr09 FR09 FLOTTER CONSTRAINT NOT NULL, fr10 FR10 FLOTTER CONSTRAINT NOT NULL Fr11 FR11 FLOTTER CONSTRAINT NOT NULL, FR12 FLOTTER CONSTRAINT NOT NULL fr12, fr13 FR13 FLOTTER CONSTRAINT NOT NULL, fr14 FR14 FLOTTER CONSTRAINT NOT NULL, fr15 FR15 FLOTTER CONSTRAINT NOT NULL, fr16 FR16 FLOTTER CONSTRAINT NOT NULL, fr17 FR17 FLOTTER CONSTRAINT NOT NULL, fr18 FR18 FLOTTER CONSTRAINT NOT NULL, fr19 FR19 FLOTTER CONSTRAINT NOT NULL, fr20 FR20 FLOTTER CONSTRAINT NOT NULL, fr21 FR21 FLOTTER CONSTRAINT NOT NULL Fr22 FR22 FLOTTER CONSTRAINT NOT NULL "(, e23, e23 FLOTTER CONSTRAINT NOT NULL, fr24 FR24 FLOAT CONSTRAINT NOT NULL, fr25 FR25 FLOTTER CONSTRAINT NOT NULL, fr26 FR26 FLOTTENT CONSTRAINT NOT NULL, fr27 FR27 FLOTTER CONSTRAINT NOT NULL, fr28 FR28 FLOTTER CONSTRAINT NOT NULL, fr29 FR29 FLOTTER CONSTRAINT NOT NULL, fr30 FR30 FLOTTER CONSTRAINT NOT NULL, status TEXT (2) st NOT NULL CONSTRAINT).

    The goal was to get the third token, 'leq_octave_5min '.

    The result string is "leq_octave_5min", but the real result string is the input string itself.

    What is the problem with my method?

    I'm sorry.

    I forgot to turn on 'regular expressions' in "Search and replace the String" VI.

    After having turned it on, it works as expected.

  • Search and replace the string formatting

    Hello

    I try to do a search and replace the formatting of a string.

    In the example, I'm looking for the string 'SUCCESSFUL', but it must also begin by usbflash and some number + PASSED.

    I can't get the format to have a number between 1 and 99. The number of replacements should add up to 6 in this case. I tried with \d for any number, and I also tried [1-99].

    Make a right-click on the function search and replace the string.  There is an option to use regular Expressions.  Then give it a try.

    EDIT: You need to set the entry replace all to TRUE.

  • GREP: Search and replace

    Does anyone know if its possible to take a list (shown on the lower part of the image) and run a GREP search and replace to create the list of tabs (shown on the picture)?

    I know that the majority of it can be made with the regular search and replace: separate the first and last name; MD and MD #; Postal code and telephone number.

    What I was not able to understand is how to add a tab forward and backward the state abbreviations 2-digit, the Middle Initial, phone number and more important even if there is a way to add tabs in when there aren't the same amount of lines, such as the field of specialty.

    I know that I can use the GREP search and replace to add a tab before each paragraph back, then remove the tab where there are 2 paragraph after each game returns, then substituting a tab and a paragraph back to just a tab, together running all the rows in each set.

    Any help would be greatly appreciated, and if there is anywhere I can learn more about GREP, I would love to learn it.

    Thank you

    Peter

    Doctors List Styles.png

    Peter, try this...

    Find:------.<>

    Replace: \t$0

  • Help with GREP search and replace

    I've never used grep before and I'm stumped.  I have a document that lists the times for different classes.  Times are variously listed as 9-10, 9-10, 9-10 or 9-10, to get examples.  The problem is that there may be no space or a space on the left or the right of the hyphen.  I want it all the time as 10:30 - 11:30, for example.  In other words, the link must have a space on each side of it.  I think that this could be accomplished with GREP search and replace, but I don't understand the syntax well enough to make it work.

    Can someone tell me how to write the search and replace expressions?  (Of course the real time could be any hours).

    Thank you!

    It is tempting to add spaces of * all numbers separated by a dash. If you don't know all time have some minutes, then it is safer to use this:

    (?<=:\d\d)>

    .. Replace with space hyphen space.

    He seeks the "settler, any digit, any digit" (which is * found * not * included *), followed by 'optional of a space, a hyphen, optional space' and must be followed by 'any number' (again, not counting this one). Since the figures before and after are * found * not * included *-which is due to the (? xxx) syntax - all that needs to be replaced is the dashboard itself. Making the space before and after the optional dashboard (using a single "?" immediately after each), no matter if it * is * a space or not, all the combinations will be found and replaced.

  • How can I use search and replace to replace the title of the doc with copy of the h1 content?

    I have a site with about 300 pages which have the same title. I need to replace this title by the same text that appears in the h1 tag on the page (each page is different). Of DW search and replace it? If so, how? I don't really want to go have to go to each page and copy/paste.

    jeffsure wrote:

    Is there a way to tell him to put only the first h1 tag in the title?

    I'm really motivated now to learn regex!

    Yes. Just use the following regular expression instead of the previous:

    ([^<>[\S\s]+?

    )([^<>

    The field is to replace the same.

    The question mark is the [\S\s]+ a lazy search, stopping at the first]

    rather than doing a greedy research that concludes the last

    in the page.

    The regex for learning is difficult, but it can be very rewarding. I would only like the best.

  • global search and replace prices

    I have about 20 catalogs I want to keep available online, but I want to delete prices.  Can anyone think of a way to do it with the global search and replace?  I think that I would have to do each doc separately because I don't want to remove all catalogs online prices.

    Thank you!

    I'm no expert with Regular Expressions, but I think it will work, assuming that all of your prices are in this format: $39.95 or $45.00.

    Search the Source Code.

    Check 'use the regular Expression' in the search panel & replacement

    Find: \W\d\d.\d\d

    Replace:

    NOTE: Test on a single page before trying it on your whole site or a folder. In addition, make backups before you start, just in case it does not work to plan.

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB

  • [CS5 JS] excluding the Notes of search and replace

    Hello

    Does anyone know how to exclude all text within a Note of a search/replace, text or grep operation?

    I went through and systematically all the findChangeGrepOptions that had the word "include" in false:

    includeLockedStoriesForFind: false

    includeLockedLayersForFind: false

    includeHiddenLayers: false

    includeMasterPages: false

    includeFootnotes: false

    just to check, but nothing has worked. myText.changeGrep () has again changed the text in the note.

    Of course, it would be pretty easy to write a wrapper function

    var myChangeGrep = function( textObject, checkNotes ) {
       checkNotes = checkNotes || false;
       results = [];
    
      // Go through and run changeGrep on all the 
      // parts of the textObject that are not contained inside Notes, 
      // (or just run it on the entire textObject if checkNotes is true),
      // and push the results to the results array as we go along.
    
      return results;
    };
    

    but it has the disadvantage that it returns a table and not a collection of InDesign, as does the regular changeGrep. In addition, as simple as it may be, it would be easier if there was a preference somewhere to take care of this.

    Any idea?

    Thank you!

    There is no preference for that: the scope of search and replace can be set only with five preferences that you have already tried. (In the same way, you can not include/exclude tables.) findGrep() and changeGrep() return an array, for that matter, not a collection.

  • Search and replace in files

    Behavior of the interrogator:

    I learned to click Save (or save everything) before attempting to search and replace in files: somehow the HR application can't handle "the currently open section" and I repeatedly got stuck in an infinite loop of the contextual dialog "this file has been modified outside the multi-fichiers (sic, old term) find and replace.» You want to reload the file? "- and it does not matter whether I click Yes (or maybe that's not serious, but I don't know the terms of Yes and no).

    It's frustrating, especially when he's stuck on a single file. After dozens of clicks. I get a popup of RoboHelp HTML (with a red ringed X) which States that "the parameter is incorrect.

    Second, maybe it's my imagination, but there was to be a rocking this user activated (de) select all... and this ability seems to be lost: if I want to limit my edit 'multifile' to tell the 3 files, I need to manually disable all other 500 topics that I don't want to change. Sorry, but I don't have a folder structure that allows me to limit my search in a folder... and reorganize the existing entries will destroy... the table of contents, the see also of hyperlinks, etc.

    Thirdly, the ability to drag the subjects of the list of topics in the current page to create a hypertext link seems to have disappeared. Maybe I dream here, as well, because the list of topics and the current page were not visible at the same time (in a previous version of HR); However, I have to are used to the click and drag the ability for the creation of hypertext links to other topics and I don't understand why it works in some cases (list of projects, TOC) but does not work for the list of topics.

    This is perhaps a few referrals, or maybe someone knows some tips of use that I am not aware... Can anyone offer insight?

    Hello

    To avoid the message about the file being modified, close everything in the editor before you start find and replace operations. The message is produced because you have the aforementioned subjects to open in the editor.

    As you mention "search and replace in files", I assume you are referring to version 8. I just opened version 8 and carried out a search and replace to confirm. There is a button allowing you to cancel all.

    By clicking and dragging to create a link, it never worked that way. You can just drag from the pod to the list of topics to do. But you can leave the pod project manager. Perhaps you should consider submitting a form wishes to request the ability to drag and drop the pod of the list of subjects to create links.

    As far as rearrange your subjects in different folders, as long as you do from within RoboHelp you shouldn't be destroying all the links. RoboHelp updates the references for you when you move things. The only question is if you automatically create the structure of your table of contents based on the structure of the project. But usually it's a one time shot. From there to the front, you just handle things by using the table of contents Editor.

    Hope this helps... Rick

    Useful and practical links

  • Advanced search and replace. How to replace the space with carriage return?

    10.9.13.0/24, 10.9.4.2/32, 10.9.4.3/32

    in

    10.9.13.0/24
    10.9.4.2/32
    10.9.4.3/32

    Find replace them ',' with carriage return.

    I still find articles on an advanced search and replace, but I can't seem to locate it.

    OS X El Capitan 10.11.3

    3.6.1 the numbers

    HI Brendan,

    You don't need an advanced find and replace for it.

    In the search box, press, then space.

    In the box replace by, press option-return.

    Then click Find and replace and find until you are finished.

    Kind regards

    Barry

  • Search and replace, unadulterated second character?

    I'm doing a VI that communicates with an external device via a protocol consisting of images. I made a couple of subVIs that put these images together as hexadecimal strings which are then converted into numbers and passed to the device. The protocol uses an escape character to avoid sending a constant BOF or EOF at the wrong time. I did a Subvi, which is supposed to do this by using the search and replace. Initially, it looks quite elegant, but it has a fatal flaw, if one of the characters it is supposed to hide is written on the edge of a byte, it will always be replaced.

    Example:

    11 01 00 CE 0D 05 08 EA

    is replaced by

    11 01 00 05 08 EA 0D E7

    C0, C1, 7 d are the characters to replace, the 7 d is the escape character.

    Now I wonder, is it possible to do a search and replace function search only every second character in a string?

    Hi Tzench,

    Why you do not work with numbers of converts? It should be easier (and safer) to replace some U8 values instead of search (errors) & replace in a string...

    You should also be careful when you give examples. So in your example, the "hex" number is separated by spaces, search & replace should not create problems with "byte-border '!

  • RegExp search and replace, keep the formatting of the original text

    Hello!

    Will have to perform the Search and replace within a framework of text using RegExp.

    And to retain the original formatting of the text block.

    How is it possible?

    Bad example-, it converts all the text formatting to the format of the first character:

    var reg = /a/gmi;
    var replacer = '*';
    var fr = activeDocument.textFrames[0];
    fr.contents = fr.contents.replace (reg , replacer);
    

    find_and_replace_regexp.jpg

    Thank you!

    I has not yet been tested your code.

    But why you did not play with my code snippet, use something like this:

    // regex_changeContentsOfWordOrString_RemainFormatting.jsx
    // regards pixxxel schubser
    var s = /arguments/gi;
    var replacer = "other string", result;
    var atf = activeDocument.textFrames[0];
    
    while (result = s.exec(atf.contents)) {
        try {
            aCon = atf.characters[result.index];
            aCon.length = result[0].length;
            aCon.contents = replacer;
            } catch (e) {};
        }
    

    Try it and have fun

  • File save to preserve search and replace queries when reinstalling?

    I need to uninstall and reinstall CS6. I have a large number in search and replace queries that would be extremely difficult to redefine. How do I save these as well as other features such as the areas of work or Actions in PhotoShop?

    Your saved queries find/replace are in a folder in your library to the user or the user's profile (depending on your operating system). You can find the path to where they are stored in the information provided for the InDesign Defaults file to replace your preferences. The folder queries saved is in the same folder as the InDesign Defaults file. Note that this is a HIDDEN on all recent operating systems folder.

    There was also a case of workspaces in the same place for ID. Similar records should be found for other programs under their respective application folders to the same location of the user's library/profile.

  • Search and replace for the color gradients?

    Just discovered new "Find and replace" tool which is very neat. However, I can't make it work with gradients. "Finding" a specific gradient if you replace all the forms with that color with another color United or degraded degraded? (Using Flash CS6; although entry users of old versions of Flash welcome whether applicable...)

    Hi Evilbob0,

    Search and replace for color, supports only solid colors.

    Gradients are not supported (in - Flash Pro CS6 and CC).

    Thank you

    Smriti

Maybe you are looking for

  • Previous

    I am impulsive and came out and got the new iPhone SE. I want my SE make the exact clone of my old 5 except with the new bells and whistles. Is it possible in itunes and will be my mail, notes, tones, apps, etc.be all intact?  THX

  • In the bar of windows svn revision number

    Hello I think about the possibility of putting on the application toolbar (exe) SVN revision number. I would be characteristic of the usueful to quickly assess, what source application, code review is to build in. What I need is therefore a kind of t

  • Acer liquid z630s

    How to keep a stock firmware backup for acer liquid z630s?

  • HP Officejet 4500 G510n-z Wireless connection print Windows Vista, but not from Windows 7

    Printer HP Officejet 4500 G510n-z seems to be connected to my Dell laptop with Windows 7 on HP Solution Center page, but does not print. Documents just get stuck in QC. It was printing then it wasn't so that's when it wasn't. The printer works when I

  • Windows 10, nothing does more.

    I've recently updated for Windows 10. The first thing I did was to try to open the first, and once the open project program is not responding. I made sure the first is updated and I even tried to run in compatibility mode for Windows 7 (which he had