Friends,
I am newbie to regular expressions, and to diffmerge utility in general
I have cisco IOS router config files ( pls treat them as txt files, nothing fancy)
I want diffmerge to skip some keywords and not highlight that particular line as change.
The original (old file) has following
ip route vrf CS 1.2.3.4 255.255.254.0 Vlan2 10.211.1.2 name ABCD
ip route vrf CS 5.6.7.8 255.255.255.240 Vlan2 10.211.1.2 name EFgh
ip route vrf CS 9.10.11.12 255.255.255.240 Vlan2 10.211.1.2 name ijkl
The new config (new file) has following
ip route vrf CS 1.2.3.4 255.255.254.0 10.211.1.2
ip route vrf CS 5.6.7.8 255.255.255.240 10.211.1.2
ip route vrf CS 9.10.11.12 255.255.255.240 10.211.1.2
Basically the new config has Vlan2/s (space) missing and name/s.* missing
for e.g: in first line
i.e Vlan2(space)
&
name(space)ABCD
are missing.
For the router (and for my purposes) they are identical. Hence I would like diffmerge to ignore the differences and not flag them as changed.
Pls help with a basic regular expression
Moderator: SourceGear
-
- Posts: 534
- Joined: Tue Jun 05, 2007 11:37 am
- Location: SourceGear
- Contact:
Re: Pls help with a basic regular expression
That's an interesting question. So much so that I had to try it and see if I could get it to work.
Unfortunately, I'm not sure that we're going to be able to do what you want.
You can create a custom ruleset for these files and add a "comment context"
for "Vlan2" to "\s" and one for "name" that ends at the EOL, and then toggle
hide-unimportant-differences in the menu. This will cause the 'ABCD' at the
end of the lines to not be highlighted, but we still show differences because
the opening delimiters (the "Vlan2" and "name") are considered delimiters
and part of the main document context and not part of the ignorable comment
context.
I'm not sure why I did it like that (there was a reason at the time, I swear).
I probably ought to add a thing to let us treat the opening delimiter in either
context and that would fix the problem here.
What we really need for this is a way to replace the regex matched content
with something or nothing *before* the diff computation is performed.
This would let your example work and help those folks using RCSID fields.
I'll log a bug for this.
Sorry I don't have a better answer for you at this time,
jeff
13959
Unfortunately, I'm not sure that we're going to be able to do what you want.
You can create a custom ruleset for these files and add a "comment context"
for "Vlan2" to "\s" and one for "name" that ends at the EOL, and then toggle
hide-unimportant-differences in the menu. This will cause the 'ABCD' at the
end of the lines to not be highlighted, but we still show differences because
the opening delimiters (the "Vlan2" and "name") are considered delimiters
and part of the main document context and not part of the ignorable comment
context.
I'm not sure why I did it like that (there was a reason at the time, I swear).
I probably ought to add a thing to let us treat the opening delimiter in either
context and that would fix the problem here.
What we really need for this is a way to replace the regex matched content
with something or nothing *before* the diff computation is performed.
This would let your example work and help those folks using RCSID fields.
I'll log a bug for this.
Sorry I don't have a better answer for you at this time,
jeff
13959
Re: Pls help with a basic regular expression
Jeff,
Many thanks for your prompt reply.
It doesn't matter, if I don't get the results right away, as long as I know there is work going to be put in for the same.
I am very grateful for such a nice product that you have, and to give it away for free is so kind of you.
Keep up the good work.
Many thanks for your prompt reply.
It doesn't matter, if I don't get the results right away, as long as I know there is work going to be put in for the same.
I am very grateful for such a nice product that you have, and to give it away for free is so kind of you.
Keep up the good work.