• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Help: Searching part of string in list

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 144
  • Views 18013
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help: Searching part of string in list

frasheed
frasheed over 11 years ago

 Hey,

Can anyone give me hint to serach part of string in list.

Example:

partName = "newStar"

fullNames = '("oldStarwork" "newStarWork" "loadStar" "halfStarwork")

if  Icheck it with member(partName fullNames) then will return nil but I want "newStarWork" as answer, I read the documenattion there is only member and memq functions are deifned for seraching lists . I looke the function recmatchp but its jist for symbol or strings and I have list (fullNames)

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    rexMatchList(partName fullNames)

    If that hadn't have been available, you could have done:

    rexCompile(pattern)
    setof(fullName fullNames rexExecute(fullName))

    But rexMatchList does this for you.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • frasheed
    frasheed over 11 years ago

     Hey Andrew,
    Thanks for the quick help it works. :)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • frasheed
    frasheed over 10 years ago

     Hey Andrew, rexMatchList is working fine for list but rexMatchp is not working properly for some cases. Example:

    I have a layout that has two gates g1 and g2 , and I am writing code to add a new property called "fix" to the instTerms

    so code goes like

     procedure(CCFaddInstPinLabels(@optional (cellView geGetEditCellView()))
    let( (transform pinCenter)
      foreach( inst cellView~>instances
        transform=inst~>transform

        foreach( instTerm inst~>instTerms
         case(instTerm~>name

          (rexMatchp("g" instTerm~>name)

            dbSetq(instTerm "G" fix)

           )

           ); case

      ); foreach instance terminal
      ); foreach instance
    );let
    ); procedure CCFaddInstPinLabels

    but it's not setting up the propert,  the problem is with matching , if I write (rexMatchp("s" instTerm~>name) then its workin fine, because there is only one source and "s" matches with the instTerm~>name.

    Can you please tell me is this method ok ?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • theopaone
    theopaone over 10 years ago

        case(instTerm~>name

          (rexMatchp("g" instTerm~>name)

            dbSetq(instTerm "G" fix)

           )

           ); case

    Case is the wrong function to use, try cond. Case evaluates its first argument and then checks for the block designated by the matched string/integer.

    Cond executes each condition (like an if/then/elif/else in other languages) and executes the block for the first condition that returns true.

       cond(

          (rexMatchp("g" instTerm~>name)

    ;; Fix the g terminals

            dbSetq(instTerm "G" fix)

           )

     

          (rexMatchp("s" instTerm~>name)

    ;; fix the s terminals

            dbSetq(instTerm "S" fix)

           )

           ); cond

    And you might want to better qualify your search, what begins with "g" is "^g"

    Ted

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • frasheed
    frasheed over 10 years ago

     Hey ted, Thanks for the reply and valuable information :)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information