• 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. Regular Expressions - Cant use | as or in group?

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 3379
  • 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

Regular Expressions - Cant use | as or in group?

PontusT
PontusT over 4 years ago

Hello!

So I am trying to use the rexMatchp to match with certain words. For example, here I am trying to match the word "dog" with the expression "cat or dog" but the function returns nil. I have tried the following:

rexMatchp("cat|dog" "dog")
nil

rexMatchp("(cat|dog)" "dog")
nil

rexMatchp("\(cat|dog\)" "dog")
nil

rexMatchp("\\(cat|dog\\)" "dog")
nil

rexMatchp("\\(cat\|dog\\)" "dog")
nil

rexMatchp("\(cat\|dog\)" "dog")
nil

After reading the manual it seems that the | operator is not included?


So my question is then, is there another way that I can implement the regular expression to give the wanted functionality? 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    I suggest you use the pcre functions instead - these are the Perl Compatible Regular Expressions - pcreMatchp is the equivalent function. This has an extremely rich syntax (it's compatible with that used in perl, as the name suggests).

    pcreMatchp("cat|dog" "dog")

    will do what you want.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    I suggest you use the pcre functions instead - these are the Perl Compatible Regular Expressions - pcreMatchp is the equivalent function. This has an extremely rich syntax (it's compatible with that used in perl, as the name suggests).

    pcreMatchp("cat|dog" "dog")

    will do what you want.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to Andrew Beckett

    I meant to say that the "rex" functions are ancient - and very limited - and only preserved for compabitlity with older releases. PCRE was introduced in IC6.1.0 (if my memory is correct) back in 2006.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PontusT
    PontusT over 4 years ago in reply to Andrew Beckett

    Okay so what I originally intended to do was to make this regex expression and use in psf like this:

    psf -i tran.tran.tran -o tran.output -e "(vout|vin)"

    but then that is not possible?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to PontusT

    I'm not really sure what that has to do with either the SKILL function rexMatchp or pcreMatchp? According to the help, it supports "regex" but as far as I can see that's just "basic" regular expressions and so also doesn't support the pipe for or-ing.

    I don't believe there have been any requests for improving that (especially as the "psf" command is only used for limited debugging, and only supports the psfbin/psfascii/psfbinf formats).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PontusT
    PontusT over 4 years ago in reply to Andrew Beckett

    Well I assumed that the rexMatchp would be the same matching as the one that was used in psf. Okay thanks for your reply :)

    • 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