• 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. Skill regex pcre {} quantifiers

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 16245
  • 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

Skill regex pcre {} quantifiers

FlxZer
FlxZer over 8 years ago

Hello folks,
 I'm trying to come up with a pcre pattern that would match at least 4 times (4 or more)  a given substring from parent string. Reading through Cadence documentation I found exactly what I need in sklangref.pdf on page 169. The example written there is this:

comPat3 = pcreCompile( "z{1,5}" ) => pcreobj@0x27d120
pcreExecute( comPat3 "zzzzz" ) => t

From my understanding, pcreExecute() should return => t  when "z"  is found at least 1 but not more than 5 times into given string. Is that correct ? I do have some perl background so I might be biased. So, If this assumption is correct the following piece of code should return nil

Theoretically:
comPat3 = pcreCompile( "z{1,5}" ) => pcreobj@0x27d120
pcreExecute( comPat3 "zzzzzzz" ) => nil
comPat3 = pcreCompile( "z{2,5}" ) => pcreobj@0x27d120
pcreExecute( comPat3 "z" ) => nil

However, when put to the test, the result is t


Practically:
comPat3 = pcreCompile( "z{1,5}" ) => pcreobj@0x27d120
pcreExecute( comPat3 "zzzzzzz" ) => t
comPat3 = pcreCompile( "z{2,5}" ) => pcreobj@0x27d120
pcreExecute( comPat3 "z" ) => t

Is there a piece of information I've missed on {} quantifiers or this is some sort of a bug?

And finally, this is how I end up asking this question. I am facing the following problem. I have a string with variables, which all have same prefix. I want to be sure that this string has at least 4 variables in it with "Don" prefix. Example:
str1 =  "  Don1 Don1_x Don1_y Don1_l Don1_w"
comPat1 = pcreCompile( "Don{4,}" )
pcreExecute(comPat1 str1) => (theoretically should return t, but it returns - nil)

str1 =  "  Don1 Don1_x Don1_y Don1_l"
comPat1 = pcreCompile( "Don{4,}" )
pcreExecute(comPat1 str1) => (theoretically should return t, but it returns - nil)

str1 =  "  Don1 Don1_x Don1_y"
comPat1 = pcreCompile( "Don{4,}" )
pcreExecute(comPat1 str1) => (theoretically should return nil. Practically it really does - nil)

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

    Point taken. However, the documentation does have a link to the PCRE web page, which is probably a better place to have a detailed coverage of the regular expression syntax rather than repeating it all directly within the Cadence help.

    Andrew.

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

    Point taken. However, the documentation does have a link to the PCRE web page, which is probably a better place to have a detailed coverage of the regular expression syntax rather than repeating it all directly within the Cadence help.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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