4 Replies Latest reply on Feb 2, 2012 7:32 AM by tbaker

    How can I search/find and replace with intelligence

    tbaker

      I used to use perl one liners for search and replace when DxDesigner schematic files were text based. This would allow me to change a net name with intelligence and not have it be a tedious process.

      In other words, if I wanted to change a prefix of nets, it could be done quickly with backreferences by doing something like:

      s/prefixA(.*)/prefixB$1/

       

      Example:

      $ cat prefix

      PrefixA1111

      PrefixA2222

       

      $ perl -pi -e 's/PrefixA(.*)/PrefixB$1/' prefix

       

      $ cat prefix

      PrefixB1111

      PrefixB2222

       

      Does anyone know of a clever way to do this with the new database versions of DxDesigner? Or perhaps there is an easy way I am missing? I tried using backreferences in the replace field, but that only made the syntax show up in the netname and they all got named the same.

       

      I am using DxDesigner IND7.9.2

        • 1. Re: How can I search/find and replace with intelligence
          olivier_arnaud

          Hi there,

           

          You can use the Find/Replace functionality of DxDesigner to do this operation pretty easily. For example I want to replace all my Uxxxx Ref Designator by Vxxxx. As you can see it on the attached picture you can use the following settings:

           

          Look in: Components

          Look for: Properties only

          Options: Whole words, Use Wildcards

           

          Find what: Ref Designator U*

          Replace with: V*

           

          You can see below the results of the command as displayed in teh output window.

           

          Searching: 'U*' for replace with:  'V*'
          Found 4 matches [in 0  sec]
          07:29:39
          Replace: property 'Ref Designator' instance value 'U1000' with  'V1000'
          Replace: property 'Ref Designator'  instance value 'U2000' with 'V2000'
          Replace: property 'Ref Designator' instance value 'U3000' with  'V3000'
          Replace: property 'Ref Designator'  instance value 'U4000' with 'V4000'
          07:29:39
          Successful Replace  Count: 4/4, Time: 0 [s], 1.#INF00

           

          You can choose the scope of the command. If you plan to run it on the entire project at a time, I would recommend you to create a backup of your project first, just in case something goes wrong (which should not happen of course! ).

           

          I hope it helps.

          • 2. Re: How can I search/find and replace with intelligence
            tbaker

            Thanks Oliver,

             

            I now see it in the dxdesigner_ref.pdf documentation under table 3-24 "Find Tab Options". I was assuming it would be under the replace tab description. I still would love to have it be a regex search and regex replace. It would make changing all lower case to upper case quick and painless. Instead I will have to do search for every letter like:

             

            search *a*

            replace *A*

             

            Or is there a better way?

             

            For Others from the documentation:

             

            Use wildcards:

            * - for multiple characters

            ? - for any single character

            Example 1:

            Find Expression - ab*cd

            Found String - abXYZcd

            Replace Expression - klm*ryz

            Replaced String - klmXYZryz

            Example 2:

            Find Expression - ad*y??

            Found String - adXWYyZRF

            Replace Expression - wert*tr??

            Replaced String - wertXWYtrZR

            • 3. Re: How can I search/find and replace with intelligence
              robert_davies

              There is a check box for regular expression substitution 'use regular expressions' it turns off the 'Use wildcards' options so that you get access to more elaborate options.

              • 4. Re: How can I search/find and replace with intelligence
                tbaker

                Are you saying it is possible to do regular expression in the replace text box then? I see how to do it for finding stuff, but I see nothing in the documentation that covers how to use it for replacing

                 

                Regular Expression Syntax in Text Searches

                 

                The property and label syntax preferences use the following regular expression syntax:

                • A regular expression is zero or more branches, separated by |. It matches anything that matches one of the branches.

                • A branch is zero or more pieces, concatenated. It matches a match for the first, followed by a match for the second, until it reaches the end of a branch.

                • A piece is an atom possibly followed by *, +, or ?. An atom followed by * matches a sequence of 0 or more matches of the atom. An atom followed by + matches a sequence of 1 or more matches of the atom. An atom followed by ? matches a match of the atom, or the null string.

                • An atom is a regular expression in parentheses (matching a match for the regular expression), a range, . (matching any single character), ^ (matching the null string at the beginning of the input string), $ (matching the null string at the end of the input string), a \ followed by a single character (matching that character), or a single character with no other significance (matching that character).

                • A range is a sequence of characters enclosed in []. It normally matches any single character from the sequence. If the sequence begins with ^, it matches any single character not from the rest of the sequence. If two characters in the sequence are separated by -, this is shorthand for the full list of ASCII characters between them (e.g. [0-9] matches any decimal digit). To include a literal ] in the sequence, make it the first character (following a possible ^). To include a literal -, make it the first or last character.