• 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. Pattern Matching of Regular Expressions

Stats

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

Pattern Matching of Regular Expressions

archive
archive over 17 years ago

I’m studing this topic and I met problem to understand this example…
 
rexCompile("\\([a-z]+\\)\\.\\1")        => t
rexExecute("abc.bc")                    => t
rexExecute("abc.ab")                    => nil
 
It is not clear why the second case is nil and if I type:
 
rexCompile("\\([a-z]+\\)\\.\\1")        => t
rexExecute("abc.bc")                    => t
 
rexSubstitute( “debug: \\0" ) => debug: bc.bc
 
Why the result is bc.bc?
 
 \1 register should not point to abc?
 
Please, could you clarify me how it works? Where could I find accurate information as the cdsdoc is not clear on how registers work.
 
Giuseppe

 


Originally posted in cdnusers.org by Giuseppe Greco
  • Cancel
Parents
  • archive
    archive over 17 years ago

    Ok, perhaps I do not understand how it works...

    rexCompile("\\([a-z]+\\)\\.\\1") ; => t
    ok,

    If I do rexExecute("abc.bc")

    \1 should contain the value matched by \([a-z]+)\, ok? In our case it should be "abc". It is correct?
    I would expect our rexCompile should be equivalent to

    rexCompile("[a-z]+\\.abc")

    so

    rexExecute("abc.bc") => nil

    and

    rexExecute("abc.ab") => nil

    Why the first is true??

    >>stand for :" search any pattern that match 'blablablaXXXX.XXXX'

    Could you explain hot to interpret rexCompile("\\([a-z]+\\)\\.\\1") ?

    Thank you,

    Giuseppe


    Originally posted in cdnusers.org by Giuseppe Greco
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 17 years ago

    Ok, perhaps I do not understand how it works...

    rexCompile("\\([a-z]+\\)\\.\\1") ; => t
    ok,

    If I do rexExecute("abc.bc")

    \1 should contain the value matched by \([a-z]+)\, ok? In our case it should be "abc". It is correct?
    I would expect our rexCompile should be equivalent to

    rexCompile("[a-z]+\\.abc")

    so

    rexExecute("abc.bc") => nil

    and

    rexExecute("abc.ab") => nil

    Why the first is true??

    >>stand for :" search any pattern that match 'blablablaXXXX.XXXX'

    Could you explain hot to interpret rexCompile("\\([a-z]+\\)\\.\\1") ?

    Thank you,

    Giuseppe


    Originally posted in cdnusers.org by Giuseppe Greco
    • 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