• 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. Allegro X PCB Editor
  3. Can I improve/simplify my regex code for finding certain...

Stats

  • Replies 4
  • Subscribers 159
  • Views 1130
  • Members are here 0
More Content

Can I improve/simplify my regex code for finding certain symbol names?

EvanShultz
EvanShultz over 15 years ago

I want to look at a comp's symbol for a keyword indicating the symbol is a leadless SMT package like BGA, QFN, etc. I'm using the code:

unique(mapcar(lambda((x) rexMatchp(x comp->package)) list(".BGA." ".DFN." ".QFN."))) == list(nil)

I check the package against a list of keywords using a regex, then I eliminate duplicate elements of the list to return a list of only nil if none of the keywords are found in the symbol (makes it easier to add additional keywords). I'm safe with this because our symbol library has naming rules which guarantee this will work.

 

This works, but seems overly complicated and requires verbose commenting. Are there better ways to do this? Here were my thoughts:

1. I tried to wrap mapcar(...) inside dptr() but it appears dtpr() doesn't interpret list(nil ... nil), or even list(nil), as an empty list.

2. The regex engine of Allegro SKILL doesn't seem to support advaned regex features I'm used to with other languages, such as pipe symbols. rexMatchp(".BGA|DFN|QFN." comp->package) always returns nil. Am I correct that advanced regex features, like pipes for alternation, aren't available in Allegro SKILL? It appears IC SKILL might from http://www.cadence.com/forums/p/14771/25538.aspx.

3. I couldn't come up with a solution that didn't use a regex, but it doesn't mean there isn't one.

  • Sign in to reply
  • Cancel
Parents
  • EvanShultz
    EvanShultz over 15 years ago

     FYI, 16.3 for Windows ships with an outdated version of sklangref.pdf. v07.02, the current release, has the pcre* functions and a few other new ones. Even zipped the PDF is more than 750kB, so I can't attach it here.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • EvanShultz
    EvanShultz over 15 years ago

     FYI, 16.3 for Windows ships with an outdated version of sklangref.pdf. v07.02, the current release, has the pcre* functions and a few other new ones. Even zipped the PDF is more than 750kB, so I can't attach it here.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

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