Diff Files contaning regex pattern string

M

Michael Yang

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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top