Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Find replace regular expression

Posted on 2006-04-16
6
Medium Priority
?
170 Views
Last Modified: 2010-03-05
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




0
Comment
Question by:wildzero
  • 2
  • 2
  • 2
6 Comments
 
LVL 85

Assisted Solution

by:ozo
ozo earned 1000 total points
ID: 16466165
s/FieldValues\['\*(.*?)\*'\]/FieldByname('*$1*').AsString/g;
0
 
LVL 10

Author Comment

by:wildzero
ID: 16466169
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
 
LVL 85

Expert Comment

by:ozo
ID: 16466283
How do you get to that box?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:Kim Ryan
ID: 16466383
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
 
LVL 10

Author Comment

by:wildzero
ID: 16466386
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
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 1000 total points
ID: 16466401
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question