|
Hi Adam, It was nice to meet you too. I agree with the whole "name with a face" sentiment. I have put your request in the list. thanks, Violaine Batthish WebSphere Development Studio Client, IBM Toronto Lab wdsci-l-bounces@xxxxxxxxxxxx wrote on 20/04/2006 02:56:51 PM: > Hi Violaine, > > Thanks for your presentation at the TEC conference on Tuesday, and your > help afterward. It was a useful presentation and it was also nice to put > a face to the name. > > Here is my request, posted to the list as requested. > I really like regular expression (RE) search. What I would like is > support for RE capture groups for search/replace. I am pretty sure this > is possible in the Eclipse Java editor if that helps any... I don't know > if LPEX can call that code or not. > > For example, suppose I have a display file with screen fields which are > prefixed by a letter 'sf' (screen field) to denote make them easy to > identify in my program. I want to do crazy display things with them (like > randomly change colours), so I have an DSPATR(field) for each of them, > prefixed with an 'sa' (screen attribute) and name the same as the field. > So now I have the following field names a bunch of places in my program > > sName > sAddr1 > sAddr2 > > aName > aAddr1 > aAddr2 > > Now, for some reason I want to change Addr1 and Addr2 to be Adrss1 and > Adrss2. This is bit silly, I know, but bear with me - I have had valid > reasons to do this, but of course now I can't remember any. :) > > What I would like to do is: > > Find: \((s|a)\)Addr\((1|2)\) > Replace: &1Adrss&2 > > So \( and \) delineate a 'capture group', with &1 and &2 being > substitution variables corresponding to the capture groups as they occur > from left to right in the expression. I would end up with: > > sName > sAdrss1 > sAdrss2 > > aName > aAdrss1 > aAdrss2 > > everywhere in the program with one fell swoop. > > In the case of nested groups: > > \(\((1|2)\)(ack|syn)\)someMoreStuff > > &1 would contain one of '1ack', '2ack', '1syn', '2syn' and &2 would > contain '1' or '2'. > > I imagine this would be difficult to implement, but it can produce some > really nice results once you get the hang of it. > > Thanks for all your work tracking these requests, > Adam
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.