Find replace regular expression

Hi there,

I have a bunch of these
FieldValues['*WORD*']
(where WORD) could be anything
and I want to change them all to
FieldByname('*WORD*').AsString
What regular expression would I use?

Thanks guys :D




LVL 10
wildzeroAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
s/FieldValues\['\*(.*?)\*'\]/FieldByname('*$1*').AsString/g;
0
wildzeroAuthor Commented:
Hmmm ok
Im trying to do it in Delphi and there is a box that says
Find what
Replace with what

i thought this would be best in the perl section as I think it uses perl regular expressions
0
ozoCommented:
How do you get to that box?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Kim RyanIT ConsultantCommented:
Yes perl uses regular expressions. But it looks like you are using your programming editor to make a global search and replace. Firstly u need to check if it supports regular expressions by reading the help section.

You may also want to look at some windows editors that can do this, such as: http://notepad-plus.sourceforge.net/uk/site.htm
0
wildzeroAuthor Commented:
Hi there,

Yes it does support regular expressions.
i goto search, then repalce
In there is a box, Use regular expressions
and there is a
Find
Replace
boxes
0
Kim RyanIT ConsultantCommented:
OK, I don't know the exact way Delphi does regular expressions, you will heed to check you online doco. But basically u should do something like
replace  FieldValues['*(\w+)*']
with       FieldByname('*$1').AsString

\w means upper or lowercase letters, the brackets groups the whole lot and the $1 substititues the value of the group. But the may use something like \1 instead of $1

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.