Structural Replace Help: Can I use regular expression in replacement template?

Hi everyone,

I am trying to migrate static factory method to a centralized factory:

calls to TemplateContentImpl.newInstance(owner) need to be replaced to

DtsFactory.newTemplateContent(owner)

There are dozens of classes like TemplateContentImpl and hundreds of calls
to newInstance()

I can find all of the call using structural search just fine and replace
them too. The problem is in Impl part.
newTemplateContent(owner) could be easilly constructed from origibal class
name TemplateContentImpl in structural replace if I only knew how to get rid
of Impl part. If I am not mistaken regular expression allow deletion of any
given number of symbols in replacement text. Can I use regular expression in
structural replace template?

Are there any better way to accomplish it?


Thank you

Alex


1 comment

Well I did it in two steps
- structural replace to achieve DtsFactory.newTemplateContentImpl(owner)
- regular expression search and replace to turn it into
DtsFactory.newTemplateContent(owner)




"Alex Roytman" <nospam@domain.com> wrote in message
news:efsnk8$fhc$1@is.intellij.net...

Hi everyone,

>

I am trying to migrate static factory method to a centralized factory:

>

calls to TemplateContentImpl.newInstance(owner) need to be replaced to

>

DtsFactory.newTemplateContent(owner)

>

There are dozens of classes like TemplateContentImpl and hundreds of calls
to newInstance()

>

I can find all of the call using structural search just fine and replace
them too. The problem is in Impl part.
newTemplateContent(owner) could be easilly constructed from origibal class
name TemplateContentImpl in structural replace if I only knew how to get
rid of Impl part. If I am not mistaken regular expression allow deletion
of any given number of symbols in replacement text. Can I use regular
expression in structural replace template?

>

Are there any better way to accomplish it?

>
>

Thank you

>

Alex

>



0

Please sign in to leave a comment.