element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) regular expression search & replace support for text variables (was: "embedding version control information in schematic and board" in userchat.eng)
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 180 subscribers
  • Views 582 views
  • Users 0 members are here
Related

regular expression search & replace support for text variables (was: "embedding version control information in schematic and board" in userchat.eng)

Former Member
Former Member over 12 years ago

 

  • Sign in to reply
  • Cancel
  • Former Member
    Former Member over 12 years ago

    Hi all,

     

    I've posted about this topic some time ago in userchat.eng (quoted

    below), in hope to trigger a discussion, but sadly got no response.

     

    So after some more experimenting and thinking, I'd like to put forward

    the following proposal:

     

    The syntax for displaying attribute values should be expanded to allow

    regular expression search & replace operations on the attribute value.

     

    Lets say the attribute SVN_ID contains the string

     

         $Id: myboard.brd 123 2011-11-14 10:14:29Z LL $

     

    A text containing

     

         "last committed >SVN_ID/Id: + + (.*) $/\1/"

     

    then would display

     

         last committed 2011-11-14 10:14:29Z LL

     

    The regex syntax above is derived from gawk, but any other regex

    syntax that allows manipulation/extraction will do.

    strxstr already supports regex searching, perhaps the library use to

    implement that, could be used for the proposed feature too.

     

     

    Any other solution I mentioned in my original post requires additional

    setup of ULPs/SCRs and poses the risk of file corruption and/or

    manipulation by faulty, corrupted or manipulated UPLs/SCRs.

     

    In addition: in combination with a version control system, solutions

    that change any text or attribute values introduce file changes, that

    in turn will be picked up from the version control system.

     

     

    Any comments welcome, but ...

     

    putting my eagle files under version control (subversion in my case).

    >One of subversions features is putting revision information into the

    >files by keyword expansion.

    >As eagle now uses XML formatted files this now works without problems.

    >Just put for instance "$URL:$" or "$Revision:$" into a text and

    >subversion will replace it with "$URL: in or updated.

    >As a first step that is ok. But ...

    >What I'd like to do is to incorporate only part of this strings into

    >my page frames. That is: I would like to display "" omitting the leading "$URL: "  and the trailing " $".

    >

    >As far as I can see that is not easily done in the moment.

    >I've considered putting the revision info into one or more hidden

    >attributes of the page frame(s) and using the "eagle -C "run xyz.ulp"

    >command line option.

    >The ULP would then process the hidden attributes and put whatever

    >derived information into text fields of the frames.

    >That should work, but requires a batch file to call eagle or fiddling

    >with the registry (in windows at least). Under Linux a command alias

    >would do the job.

    >Anyhow this solution requires that this batch file, registry hack or

    >command alias is installed on every workstation.

    >

    >I would like to propose one of the following solutions.

    >Either implement some sort of search&replace possibility for eagles

    >text placeholders (there is already a regular expression engine in

    >eagle used by the strxstr function),

    >or a new meta text placeholder ">ULP ulp-name ulp-parameters ..."

    >Both solution would solve my immediate needs.

    >

    >What do you think?

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dukepro
    dukepro over 12 years ago in reply to Former Member

    On 03/05/2013 05:53 AM, Lorenz wrote:

    Hi all,

     

    I've posted about this topic some time ago in userchat.eng (quoted

    below), in hope to trigger a discussion, but sadly got no response.

     

    So after some more experimenting and thinking, I'd like to put forward

    the following proposal:

     

    The syntax for displaying attribute values should be expanded to allow

    regular expression search & replace operations on the attribute value.

     

    Lets say the attribute SVN_ID contains the string

     

         $Id: myboard.brd 123 2011-11-14 10:14:29Z LL $

     

    A text containing

     

         "last committed >SVN_ID/Id: + + (.*) $/\1/"

     

    then would display

     

         last committed 2011-11-14 10:14:29Z LL

     

    I second this request.  The embedded syntax needs a bit of refinement.

    We can borrow an already familiar syntax from the Bourne-Again Shell (bash):

     

        ${SVN_ID//regex/replacement/}

     

    GNU Make also has a syntax that is worth noting:

     

        ${subst /from,to,text/}

     

    The latter lends itself well to other extensions:

     

        ${regex /pattern,replacement,text/}

        ${shell argv0 argv1 argv2 ...}

        ${ulp ulpname argv1 argv2 ...}

     

    Lorenz' example would be to set a text value to:

     

        "last committed >${regex 'Id: + + (.*) $','\1',$SVN_ID}"

     

    In addition: in combination with a version control system, solutions

    that change any text or attribute values introduce file changes, that

    in turn will be picked up from the version control system.

     

    True.  The parsed value should not be stored in the file.  ULP

    references to the UL_TEXT object should be able to provide both the

    original unparsed text, and the result.

     

        UL_TEXT mytext;

        ...

        mytext.value    is the processed result, just as it is now

        mytext.preval    is a new data member containing the unprocessed

    string as stored in the file.

     

    Other ideas?

     

        - Chuck

     

     

    Attachments:
    4382.att1.html.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 12 years ago in reply to Former Member

    How frustrating,

     

    no one out there interested enough in this to at least shoot the idea

    down?

    --

     

    Lorenz

     

     

    Lorenz wrote:

    I've posted about this topic some time ago in userchat.eng (quoted

    below), in hope to trigger a discussion, but sadly got no response.

     

    So after some more experimenting and thinking, I'd like to put forward

    the following proposal:

     

    The syntax for displaying attribute values should be expanded to allow

    regular expression search & replace operations on the attribute value.

     

    Lets say the attribute SVN_ID contains the string

     

    >     $Id: myboard.brd 123 2011-11-14 10:14:29Z LL $

     

    A text containing

     

    >     "last committed >SVN_ID/Id: + + (.*) $/\1/"

     

    then would display

     

    >     last committed 2011-11-14 10:14:29Z LL

     

    The regex syntax above is derived from gawk, but any other regex

    syntax that allows manipulation/extraction will do.

    strxstr already supports regex searching, perhaps the library use to

    implement that, could be used for the proposed feature too.

     

     

    Any other solution I mentioned in my original post requires additional

    setup of ULPs/SCRs and poses the risk of file corruption and/or

    manipulation by faulty, corrupted or manipulated UPLs/SCRs.

     

    In addition: in combination with a version control system, solutions

    that change any text or attribute values introduce file changes, that

    in turn will be picked up from the version control system.

     

     

    Any comments welcome, but ...

     

    <getting ready to duck and run>

     

    ... don't tell me this won't be available in the next beta 8-)

     

     

     

    Lorenz wrote:

    after I've finally upgraded to eagle 6, I'm now experimenting with

    putting my eagle files under version control (subversion in my case).

     

    One of subversions features is putting revision information into the

    files by keyword expansion.

    As eagle now uses XML formatted files this now works without problems.

     

    Just put for instance "$URL:$" or "$Revision:$" into a text and

    subversion will replace it with "$URL: <path to file in repository> $"

    and "$Revision 12345 $"  every time the file is checked out, checked

    in or updated.

     

    As a first step that is ok. But ...

     

    What I'd like to do is to incorporate only part of this strings into

    my page frames. That is: I would like to display "<path to file in

    repository>" omitting the leading "$URL: "  and the trailing " $".

     

     

    As far as I can see that is not easily done in the moment.

     

    I've considered putting the revision info into one or more hidden

    attributes of the page frame(s) and using the "eagle -C "run xyz.ulp"

    command line option.

    The ULP would then process the hidden attributes and put whatever

    derived information into text fields of the frames.

     

    That should work, but requires a batch file to call eagle or fiddling

    with the registry (in windows at least). Under Linux a command alias

    would do the job.

     

    Anyhow this solution requires that this batch file, registry hack or

    command alias is installed on every workstation.

     

     

    I would like to propose one of the following solutions.

     

    Either implement some sort of search&replace possibility for eagles

    text placeholders (there is already a regular expression engine in

    eagle used by the strxstr function),

     

    or a new meta text placeholder ">ULP ulp-name ulp-parameters ..."

     

    Both solution would solve my immediate needs.

     

     

    What do you think?

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 12 years ago in reply to autodeskguest

    Lorenz wrote on Wed, 13 March 2013 06:02

    How frustrating, no one out there interested enough in this to at least

    shoot the idea

    down?

     

     

    Cadsoft isn't going to jump on something that clearly nobody cares about.

    It's not worth rebutting it since it will go away all on its own.

    --

    Web access to CadSoft support forums at www.eaglecentral.ca.  Where the CadSoft EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube