I'm using BeyondCompare3 i've two files with lines containing with this kind of format.
abc,bbbb,cdef,test,14:45:23.123,info,comment
I want to omit the date from the comparison.
I've selected Session > Session Settings > Importance Tab > Edit Grammar button and created a new rule.
After entering an Element name, I've selected Category of Basic, checked Regular Expression and searching for Text.
[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,3}. I've also tried /[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,3}/.
I then click 'ignore unimportant differences' on the tool bar.
I was hoping this would ignore the date column in the comparison. But it doesn't.
Any pointers on this or other tools/scripts would be very much appreciated.
John.
In Beyond Compare 4.1.9, you can ignore Modified Date by unchecking "Compare timestamps" in tab "Comparison" of the "Rules" window.
You can also add a regular expression to define text to be ignored (Unimportant text) in the Rules section like so:
https://www.scootersoftware.com/vbulletin/forum/beyond-compare-2-discussion/beyond-help/2292-set-to-ignore-date-and-timestamp-difference
In a 'Table Compare' session, comparing both files do the following:
Select rules, tab columns;
Edit the date column;
Check the unimportant checkbox;
Enable minor (to ignore minor and unimportant differences);
A date tolerance is also an option, but that is not your question.
Related
I have a text file.
There are hundreds of different filenames in the text file.
However, it says different date and time at the end of each file.
Sample: life-in-cosmos-2021-11-11-12-45-46 or life-in-cosmos-2021-11-11-12-45.
In order to change the names of the files in bulk, I first need to delete the dates in this text file.
So I want to automatically delete the dates and times in each row.
However, I don't know anything about this.
And I don't know how to use macros.
Therefore, if there is a solution for this, can you provide an answer with a picture or video?
In order to explain my request more clearly, I present 2 examples.
Example:
Original Text: cosmos-lights-colors-T5DAPC-2020-09-11
The result I want to do: cosmos-lights-colors-T5DAPC
Example 2:
Original Text: cosmos-lights-colors-T5DAPC-2021-04-02-12-37-49-utc
The result I want to do: cosmos-lights-colors-T5DAPC
Assuming a date is always at end of each line, you can replace a regular expression with an empty string. To do this:
Press Ctrl+H to bring up the Replace dialog box, and set following options:
Find: -[0-9]{4}-[0-9]{2}-[0-9]{2}[0-9\-]*?(\-utc){0,1}$
Replace with: (blank)
Set the Regular Expressions option
First, click the Find Next button to highlight matches to make sure they are correct. If the matches are incorrect, you will need to adjust the regular expression.
Finally, click the Replace All button to remove all matched strings.
Before replace
cosmos-lights-colors-T5DAPC-2020-09-11
cosmos-lights-colors-T5DAPC-2021-04-02-12-37-49-utc
After replace
cosmos-lights-colors-T5DAPC
cosmos-lights-colors-T5DAPC
There is a problem with the formatting of certain .docx files. I click to show the hidden formatting marks. There are degree symbols ("non-breaking spaces") in between many of the words, instead of a regular space.
To solve the problem: I copy and paste the degree symbol, and then I use the "find and replace" function to replace the degree symbols with a regular space.
How do I prevent this problem from occurring in the first place?
Or, how can I automatically convert these symbols to a regular space.
Non-breaking spaces are used to keep words from breaking across lines.
As Cindy stated above, the simplest way to remove them manually is to record a macro and execute this from a Ribbon button or the Quick Access Toolbar.
According to this link (and this link it refers to), nonbreaking spaces are inserted automatically if your proofing language is set to French and you type certain characters. To prevent this from happening, you have to either use a different proofing language or disable the "Replace straight quotes with smart quotes" option. To do this, see below (and I'm quoting the previous link):
To change the proofing language, select the text and click Language on
the Review tab. In addition to choosing another language, it's a good
idea to uncheck the option to automatically detect the language.
To change the quotes replacement, click File > Options > Proofing >
AutoCorrect Options, choose the AutoFormat As You Type tab of the
dialog (not just AutoFormat), and uncheck the first option.
In a branch of code I have changed all of the code from obj.varname to obj("varname") and when I compare the code I would like to ignore these differences since varname is the same.
I have a regular expression that I think I need but unfortunately can't get the comparison to be ignored using Beyond Compare from Scooter
^obj\("\w*"\)|obj\.\w*$
I am following this tutorial http://www.scootersoftware.com/support.php?zz=kb_unimportantv3
So my question: is this even possible with beyond compare? If yes, please share a solution including either instructions or post your screenshots.
Beyond Compare 3's Professional edition supports this through its Text Replacements feature. If you've already purchased a Standard edition license you need to revert to trial mode to test it: http://www.scootersoftware.com/suppo...?zz=kb_evalpro
Load your two files in the Text Compare.
Open the Session Settings dialog from the the Session menu, and on the Replacements tab click New to create a new replacement.
In the Text to find edit, use (\w+)\.(\w+)
In the Replace with edit, use $1("$2")
Check the Regular expression checkbox.
The alternative would be to mark any instance of obj.varname and obj("varname") as unimportant. The basic steps would be this:
Load your two files in the Text Compare.
Open the Session Settings dialog from the Session menu, and on the Importance tab click the Edit Grammar... button.
In the next dialog click the New... button below the top listbox.
Change the Element name field to something useful (say, "PropertyAccess").
Change the Category* to List.
In the Text in list* edit, add these two lines:
obj.varname
obj("varname")
Click OK to close the Grammar Item dialog and then click OK again to close the Text Format* grammar item.
Uncheck "PropertyAccess" (or whatever you named it) in the Grammar elements listbox in the Session Settings dialog, then click OK to close it.
This approach isn't as flexible or clean. In the steps above you're matching specific, hardcoded object and variable names, so obj.varname is unimportant but obj.othervar isn't, even if it's aligned against obj("othervar"). If text on both sides is unimportant the difference will be unimportant; if one side is important it will be an important difference. So, with the above steps, obj.varname and obj("varname") will be unimportant everywhere, but it will work correctly since they'll either be matched to other cases that also match those definitions (and thus unimportant) or will be matched to something else that doesn't match that definition, which will be important and will make the difference important.
You can use regular expressions to match more general text categories, but you probably don't want to. For example, if you wanted to match all text that followed that pattern you could use these two lines instead:
\w+\.\w+
\w+\("\w+"\)
And then check the Regular expressions checkbox in the Grammar Item dialog so they're matched that way.
The upside/downside to that is that any text that matches those patterns is then unimportant. abc.newvar vs. def.varname would be considered an unimportant difference because both sides match the unimportant definition. That's good for things like comments or whitespace changes, but probably isn't what you want to do here.
I have a Word document with fields of the reference variety, which occur in the form "[field].[field]"--in other words, there's a period between the two fields. I want to globally replace this with a space.
Word offers the ^d special character to search for fields, but for some reason the query "^d.^d" does not find anything. However, ".^d" does. Now comes the problem, however--what do I specify as the replacement text in order to retain the field code? If using regular expressions, I could use a "Find What Expression" such as \1, but with regexp ("wild card") mode the ^d is not permitted.
I guess I could write a macro...
I would like to add to Bibadia's solution.
An example of an index entry field; we want to change a name we misspelled.
Make sure hidden formatting is displayed (toggle with SHIFT+CTRL+F8).
Make sure wildcards option is not selected. To search for fields, use the opening and closing field braces code (optionally use ^w for spaces, as Bibadia suggested):^19 XE "Deo, John" ^21
Replace won't recognize field braces character, but will allow to insert the clipboard's content. ;). To do that, insert in text the correct entry. CTRL+F9 to insert field and type:XE "Doe, John"
Select the field above and copy
Use ^c in the replace box
Hit Replace All
Ta-da!
It's usually better to go the macro route when finding fields because, as you say, the find algorithm that Word uses doesn't work the way you might hope with fields.
But if you know exactly what the fields contain, you can specify a search pattern that will probably work (however not in wildcard mode).
For example, if you want to look for figure number field pairs such as
{ STYLEREF 1 \s }.{ SEQ Figure \* ARABIC \s 1 }
(which would typically be the same set of fields everywhere in the document)
If you only really need to look for the following:
{ STYLEREF 1 \s }.<any field>
you could ensure that field codes are displayed and search for
^d STYLEREF 1 \s ^21.^d
or
^19 STYLEREF 1 \s ^21.^19
If you need to be more precise, you can spell out the second field as well.
"^d" only works for finding the field beginning, not the field end.
It's a shame that ^w wants to find at least 1 whitespace character because otherwise it would be more robust to look for
^19^wSTYLEREF^w1^w\s^w^21.^19
Perhaps someone else knows how to work around that without using wildcards?
Torzaburo,
I suggest that you do this using a macro. You can start by recording the macro, and later refining your processing steps within the macro.
First turn on the hidden characters by navigating to Home > Paragraph > toggle the show/hide Paragraph symbol. Also, select all and toggle the field codes on (right-click and select "Toggle Field Codes".
Open a new blank Word doc in addition to the one you have open. You will use this later. Start the macro recording and find the field using the "^d" (field code) as you said.
When the field is found, copy only the field text within the brackets, and not the full field reference. While the macro is still recording, ALT + TAB to the new blank document and paste the field code in as plain text.
At this point, do the necessary find & replace processing to the field codes. Highlight the processed field codes, copy, ALT + TAB back to the original document, and paste back between the { } brackets.
Stop the macro recording. Add any further custom processing to the macro VBA.
Select-All and re-toggle the field codes. Update the field codes.
You don't need a macro. Just toggle all field codes on by using Alt+F9. Then do a find and replace for what you want to change. Once the replacement is complete, use Alt+F9 again to toggle the field codes back off.
Disclaimer: I didn't originate this solution, but it's clean and elegant and I thought it should be included here:
(Adapted from Search & Replace Field Codes in Word):
Create or find a single instance of the field you want to convert text to
Toggle Field Codes visible (AltF9)
Copy the code for the field you want to use to the Clipboard (highlight and CtrlC)
Open the Replace dialog box (CtrlH), insert the text you want to replace in the Find What box and then enter ^c in the Replace With box.
This will replace your text with the contents of the Clipboard, turning it into the field code you copied in step 3. It also copies formatting information (font, color, etc.), to control how the field will appear when hidden. (Caveat: I've tested this with Word 2003 under Windows 7 only.)
Coming in late on this, probably way too late for Beth (sorry Beth). And this may not be quite what Beth was looking for. But for anyone interested ...
It sounds like Beth may have created captions throughout the document using INSERT CAPTION (hence the presence of field codes). This means these captions will have been (automatically) created in CAPTION style.
To globally replace the separator "." with " " (space) in such captions, take two steps:
[1] Go to REFERENCES | INSERT CAPTION, then click on NUMBERING and replace the SEPARATOR "." with "EM-DASH". This will replace all separators in captions for the selected label in the CAPTION Window. If you have other labels in use in the document (e.g. FIGURE), select the other labels one by one and repeat this process.
[2] Do a find/replace searching for special character "em-dash" (^+) in style CAPTION, replacing with " ". Click REPLACE ALL.
Voila!
NOTE: This presumes that em-dash does not appear in the caption text anywhere. If it does, then you'll need to do a pre- and post- "fiddle" to ensure these em-dashes are not touched by the global replace above.
The "pre-fiddle" is to do a global find/replace across captions, replacing the em-dash ("^+") with some other string (e.g. "EM-DASH") that doesn't ever occur in any caption's text. Then you do the separator change as described above. Finally, the "post-fiddle" is to restore the em-dashes that were in the captions, by doing a global replace of the string "EM-DASH" with the actual em-dash character "^+".
argh!
Can't stand it that i can't figure it out myself....
i've used this in the formatting of a number in my report:
'€' #,0.00;('€' #,0.00)
and that formats to € 1,212.89
which is not exactly what i want, because i want € 1.212,89
regardless of the regional setting of the server.
So i tried this
'€' #.0,00;('€' #.0,00)
but that gives me this:
1.212.890
Typing this i realize that i don't know what the # and the . and the , mean in the format string.....
You can find the definition of the comma and period dynamic behavior here:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
I think the best way to reliably get what you want is to hard code a locale into the expression for this field.
= (new Decimal(11123.55)).ToString("€#,0.00;(€#,0.00)",
new System.Globalization.CultureInfo("es-ES"))
This will always use the comma as decimal, and period as millions, thousands &c.
There are ways to be more dynamic and always return in the clients local set format, that would usually be preferable.
I know this is an old thread, but in case someone needs it, there is an easiest and most proper way to do it :
Right click on the Textbox of your expression
Select "Number" in the popup "Text Box Properties"
In the "Category", select "Number"
Tick the "Use 1000 separator
Click OK
To "customize" your '1000 separator':
Select the Textbox of your expression
In the Properties on the right, apply the right culture in the "Language" property.
E.g. Select "fr-CH" to have 123'456 otherwise the default is 123,456 as English separator.
Try this out. It will format your value to the correct number of decimal places.
=format(1212.89,"€#,#.00")
For indian currency, in the field value use like =Format(Fields!ServiceTaxAmt.Value,"##,##,##,###.00") and change the language value to hi-in for report property.
You can use the format € #,0.00 and set the language of your report to de-DE by clicking outside of the report area and in the right properties pane go to Localization -> Language.
This Works correctly with [set Language as hi-IN and Format as "##,##,##,###.00"]
Appreciate your Efforts
Also Same can be achieved by following Steps
Go to Text Box Properties
Select Number category in Number Tab
Check the check box beside [Use 1000 separator(,)]
Click Ok