• 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. To extract a sub list from a given list (of strings) which...

Stats

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

To extract a sub list from a given list (of strings) which matches a give string at the beginning

Sonu Chopra
Sonu Chopra over 5 years ago

Hello,

I want to extract a sub-list from a given list which matches a given string at beginning

For Example :- 

Given list   a = ("RM_1" "RM_2" "RM_5" "RM_6" "SRM_1" "SRM_5" "SRM_6" "M_5" "M_6")

                  b = "RM" (String to match to given list)

                Expected Output = ("RM_1" "RM_2" "RM_5" "RM_6")

I want String to match exactly at the beginning but at the end it can be anything.

I am referring to this Post  https://community.cadence.com/cadence_technology_forums/f/custom-ic-skill/38267/search-list-and-return-the-match-list but it also return ("SRM_1" "SRM_5" "SRM_6") which is not desired for me.

Can you please help me out on this point.

Regards

Sonu 

  • Cancel
Parents
  • mbracht
    mbracht over 5 years ago

    b = (setof el a pcreMatchp( "^RM" el))

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sonu Chopra
    Sonu Chopra over 5 years ago in reply to mbracht

    Hello Max ,

    The issue is that list b is stored in some Variable and I don't know what is exactly inside list b . So , I can't use "^RM" Directly. This Example was just for Reference.

    Regards

    Sonu

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mbracht
    mbracht over 5 years ago in reply to Sonu Chopra

    Not sure I understand this - in your example b is not a list but a variable containing the string that should be at the beginning of matching list elements. So correctly the setof() function should look like this:

    a = '("RM_1" "RM_2" "RM_5" "RM_6" "SRM_1" "SRM_5" "SRM_6" "M_5" "M_6")
    b="RM"
    (setof el a (pcreMatchp (strcat "^" b) el))

    Max

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Sonu Chopra
    Sonu Chopra over 5 years ago in reply to mbracht

    Hello Max,

    Sorry there was a typo.. You are correct string is stored in Variable b.

    Your solutions work fine for me and thanks for all the help.

    Regards

    Sonu

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Sonu Chopra
    Sonu Chopra over 5 years ago in reply to mbracht

    Hello Max,

    Sorry there was a typo.. You are correct string is stored in Variable b.

    Your solutions work fine for me and thanks for all the help.

    Regards

    Sonu

    • 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