• 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 Scripting - Skill
  3. Execute Regular Expression in Skill

Stats

  • Replies 3
  • Subscribers 18
  • Views 9253
  • Members are here 0
More Content

Execute Regular Expression in Skill

HighFive
HighFive over 4 years ago

Hello friends,

Here's what I'm trying to accomplish, and where I've hit a roadblock: my skill program writes a .scr script, and then needs to execute the .scr file. The problem is, the .il file resides in C:\Cadence\Setup\, and the .scr file is writtent to whatever the current design directory is. So with a .BRD file open in Allegro, the .scr file is written to the same directory as the BRD file. This causes a problem- the .il skill file can't execute the .scr file. So I'm trying to parse the current design directory with axlCurrentDesign().

Which returns a string of the form: c:/users/poppy/documents/cadence/boardX/allegro/512_238.brd

Now I just need to trim the last part of the string off, everything after the last "/", such that the returned result is:

c:\users\poppy\documents\cadence\boardX\allegro\

Then I can use the above string as the directory file to write the .scr to. I tested by placing the file there manually and it works. So I need  to trim the path after the last "/".  I'm trying to do with regex, but can't get the pattern right. A patter that in theory works is: 

([/]*)$
I can't get it to work for me though. Can anyone help with the pattern entry? Then I will be calling:
rexCompile("\\\\([^/]*\\\\)$")
dir= rexReplace(dir, "", 0)

  • Sign in to reply
  • Cancel
  • HighFive
    HighFive over 4 years ago

    EDIT:

    Got it figured out. I guess I was overthinking it. I saw a bunch of threads with many "\\\\" to escape the backslash, so figured I needed that as well. What worked for me was:

    rexCompile("[^/]*$")
    dir = rexReplace(dir,"", 0)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • B Bruekers
    B Bruekers over 4 years ago

    Check the axlDMFileParts() function.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • HighFive
    HighFive over 4 years ago in reply to B Bruekers

    Awesome that does exactly what I need it to! Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
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