Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Diff Files contaning regex pattern string

Reply
Thread Tools

Diff Files contaning regex pattern string

 
 
Michael Yang
Guest
Posts: n/a
 
      05-13-2007
Here I have two files to diff, let's say one is a base file, the other
is a result file.
<base file>:
Conntected to the '.*'
Hello, I am .*
Glad to see you .*
<result file>:
Connected to the 'www.perl.com'
Hello, I am michael
Nice to meet you, all

There are regex pattern string ".*" in the base file, indicating that
it could be replaced by any text.
When the regex string of ".*" occurs, it should be detected that
whether it matches the counter-part in the result file. If it matches,
as shown above, the two lines are considered as equal.

So when diff the above two files, only the last line of two files are
in the diff data:
Glad to see you .*
and
Nice to meet you, all

If I want to do this, I need to implement my own diff algorithm.
Is there any way simpler to achieve this? Like if there is a
comparison function, designed by this regex algorithm, could be passed
to Diff object, the diff program will compare two files based on the
rules I gave to it.

Your helps are greatly appreciated.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Regex to breakdown a pattern and use the pattern to breakdown a string ChrisC Perl Misc 4 06-25-2010 05:46 PM
replace string contaning \n cieux87-fin@yahoo.com Perl Misc 5 11-14-2007 12:08 PM
String Pattern Matching: regex and Python regex documentation Xah Lee Python 8 09-26-2006 03:24 PM
String Pattern Matching: regex and Python regex documentation Xah Lee Perl Misc 2 09-25-2006 03:15 AM
String Pattern Matching: regex and Python regex documentation Xah Lee Java 1 09-22-2006 07:11 PM



Advertisments