Title: Message
here's a short example
 
$data="file://one two three four five six seven eight nine ten";
$words="two four six eight ten";
$filter='('.join('|',split(/\s+/,$words)).')';
print "filter: $filter\n";
print "$data\n";
$data =~ s/$filter/BITE ME/gi;
print "$data\n";
 
see if you can figure out how it works, and if you have trouble figuring it out, ask away...
-----Original Message-----
From: William Martell [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 21, 2002 1:49 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Regex With Common Applications

 

 Hello Perl Users,

I am curious whether there is a way to search a data store for a list of
values and if any of those values are matched, replace it with a single
common value.

Currently, I can only use a Search and Replace engine to find and replace
a single value.

I have a text file with 1000 words that I would like the computer to scan
for in the data store and if it finds the value, replace the value with
the word "DELETE ME".

I thought it would be possible using regular expressions but I wasn't
sure.

Ideally, I would like to create one text file with only the words to find.
I would export data from MySQL into a delimited text file.   Then I would
pipe that file into the search engine in order to find and replace the
values.

Is this possible?  Any pointers would be appreciated.

Thank you in Advance.
William

 

PS.  Is this possible using common applications such as Excel or with text editors such as NoteTab (TM).

 


 

 

 

 

 

 

 

------------------------------------------
William Martell

Dallas TX, USA

Tel: 972 270 6191 

E-mail: [EMAIL PROTECTED]

MCSE, CCNA, CCNP, SCSA,

JAVA, CIW, A+, NETWORK+,

ORACLE 9i DBA

Reply via email to