• 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. rexMatchp

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 142
  • Views 4496
  • 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

rexMatchp

dakuang01
dakuang01 over 1 year ago

Hello! 

I think I need a clearer understanding on the function rexMatchp.

I'm trying to get a list not having cells starting the name with "mesh2_20x20" so I'm using the function.

Here's some of the experiments of it.

I wasn't expecting the two cases in pink would give me t. I was expecting nil. Am I missing anything here or any advice please?


rexMatchp("mesh2_20x20*" "mesh2_20x20")
t
rexMatchp("mesh2_20x20*" "mesh2_20x20_OL")
t
rexMatchp("mesh2_20x20*" "mesh2_20x21")
t
rexMatchp("mesh2_20x20*" "mesh2_20")
nil
rexMatchp("mesh2_20x20*" "mesh2_20x2")
t

Thanks,

dakuang01

  • Cancel
  • dakuang01
    dakuang01 over 1 year ago

    Oh I just found out it worked good by using both rexCompile and rexExecute!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to dakuang01

    First of all, I would advise against using rexMatchp unless you really need to have code that works in IC5141. The PCRE functions (e.g. pcreMatchp, pcreCompile, pcreExecute etc) support a much richer regular expression syntax than the POSIX rex functions.

    The issue with your results (and I don't see why rexCompile/rexExecute would behave differently - they don't in my experiments) is that the end of your expressions are "0*" This does not mean 0 followed by anything, it means any number (including zero) of the character 0. So it matches "", "0", "00", "00000" etc. The regular expressions are not anchored, so they will match starting anywhere and ending anywhere - so characters which follow the matching part are irrelevant in the success. Perhaps you wanted: "^mesh2_20x20.*" or even just "^mesh2_20x20" - omitting the final *

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • dakuang01
    dakuang01 over 1 year ago in reply to Andrew Beckett

    Yes my bad. I also noticed that omitting the final * worked for both rexMatchp and rexCompile/rexExecute.

    Can I take that "^" in front function as a starting point?
    I tried to search what each meta-character does but unfortunately couldn't find.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to dakuang01

    Yes, ^ at the beginning means the beginning of the string. $ at the end means to match the end. If you look at the documentation for rexCompile, it explains the meaning of the magic characters. For PCRE though you can just use "man perlre" to see the regular expression syntax (there are lots of resources on the web covering this, including https://en.wikipedia.org/wiki/Regular_expression - for the "rex" functions see the "BRE" part of the POSIX section; for PCRE there's a PCRE section).

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • dakuang01
    dakuang01 over 1 year ago in reply to Andrew Beckett

    Thank you Andrew for your great help. You're amazing.

    • 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