• 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. Regex - named group for subrutine

Stats

  • Replies 0
  • Subscribers 17
  • Views 967
  • Members are here 0
More Content

Regex - named group for subrutine

mir0mik
mir0mik over 4 years ago

Hello everyone,

Is it possible to use DEFINE statement for regular expression with pcreCompile()? I building a big regular expression where I would like to use DEFINE to define a set of characters and then use only the name of the set for different actions in the pattern (like restrict double characters etc...) but it looks like pcreCompile can not handle DEFINE or am I doing something wrong?

I would like to compile something like this

(?(DEFINE)(?'foo'[a-z]))A\g'foo'

- define named group "foo" which represent range [a-z] (in my expression is much more longer and I would like to edit it only on one place not copy several times is I need to add something to the group...) but it self is not matching until called by the \g'foo' (I would like to use this in different part of the expression for different uses)

pcreCompile( (?(DEFINE)(?'foo'[a-z]))A\g'foo') doesn't work Disappointed

Regards,

Miro

  • Cancel
  • Sign in to reply
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