1. Determine version of UltraEdit or UEStudio.
For most find/replace/regular expressions questions the version of UltraEdit (short: UE) or UEStudio (short: UES) is very important.
Click in menu Help on the item About to determine the version of UE/UES you use.
If you think you have found a bug (error in program code) and you want to verify it by other users, the exact version of UE/UES is essential.
Real bugs must be reported by email to IDM support. See the 2 paragraphs at top of this page.
2. Determine the regular expression engine.
Most complex find/replace operations can be only executed with a regular expression (short: regex) find/replace. But depending on your version of UE/UES up to 3 different regex engines are supported by UE/UES. To determine the regex engine you currently use, do following:
- For UE up to v11.10c or UES up to v5.00b:
In menu Advanced (Advanced menu profile) or File (Basic menu profile) click on item Configuration. Next click on tab Find and look at the configuration option Unix style Regular Expressions.
If this configuration option is checked, you use the Unix regex engine.
If this configuration option is disabled, you use the UltraEdit regex engine.
- For any UE v11.20 or any UES v5.10:
In menu Advanced (Advanced menu profile) or File (Basic menu profile) click on item Configuration. Next click on Searching in the tree and look at the configuration option Unix style Regular Expressions in right panel.
If this configuration option is checked, you use the Unix regex engine.
If this configuration option is disabled, you use the UltraEdit regex engine.
- For UE up to v13.20a or UES up to v6.40a:
In menu Advanced (Advanced menu profile) or File (Basic menu profile for UE < v13.00) click on item Configuration. Next expand Search in the tree and click on Regular Expression Engine. There are 3 regex engine for your choice in the right panel:
Perl compatible Regular Expressions
UltraEdit style Regular Expressions
Unix style Regular Expressions
- For UE since v14.00 or UES since v6.50:
The regular expression engine can be directly selected in the Find/Replace/Find In Files/Replace In Files dialogs. If you cannot see the regex options, click on button Advanced in the dialog
3. Read the help pages for find/replace/regex.
Many questions can be answered by yourself if you read the help pages of UE/UES for find/replace/regex completely and carefully. Open the find/replace dialog, look on all the options you have and press the button Help to get displayed the help page for this dialog. The find/replace help pages contain important informations for usage of find/replace like a description for all options and a table with special characters. If you have to do a complex find/replace and so must perfom a regex find/replace, read also the help page for regular expressions linked on the find/replace help pages depending on the regex engine you use.
The escape character for UltraEdit style regex characters in a regex search string is BY DEFAULT the caret character ^.
The escape character for Unix/Perl style regex characters in a regex search string is ALWAYS the backslash character \.
Escaping a regex character means to use the escaped regex character in the regex search string as normal character and not with the regex meaning.
You can configure a different special/escape character in the search configuration dialog with the setting Special character used in find/replace strings (normally ^) for non regex or UltraEdit regex find/replace operations with special characters. But you should not change it without a real reason like your keyboard does not have a key for ^ or you often search for strings with ^ as normal character inside.
You should also look on the list of FAQs for UltraEdit (frequently asked questions) and the Power Tips on this website.
Pages on the UltraEdit website which are maybe interesting for you:
- FAQ: How can I delete blank lines with or without blank tabs/spaces in UltraEdit?
- FAQ: How can I do a multi-line Find/Replace in UltraEdit?
- FAQ: How can I remove lines that contain a particular string?
- FAQ: Why does Find Next (F3) not find selected/highlighted text anymore although the appropriate configuration setting is set?
- Power tip: Incremental search
Incremental search is an inline, progressive search that allows you to find matched text as you type, much like Firefox's search feature.
- Power tip: Remove blank lines
A question which is frequently asked is "I have a lot of blank lines in my file and I don't want to go through and manually delete them. Is there an easier way to do this?" The answer: YES!
- Power tip: Regular expressions
Regular Expressions are essentially patterns (rather than specific strings) that are used with Find/Replace operations. This guide can dramatically improve your speed and efficiency for Find/Replace.
- Power tip: Regular Expression Builder
Regular Expressions are essentially patterns, rather than literal strings, that are used to compare/match text in Find/Replace operations. As an example, the * character in a Perl regular expression matches the preceding character or expression zero or more times...
- Power tip: Perl regular expressions: Getting started
An introduction to using Perl-style regular expressions for find and replace in UltraEdit and UEStudio
- Power tip: Perl regular expressions: Non-greedy regex
How to make Perl regular expressions "non-greedy" in UltraEdit and UEStudio
- Power tip: Perl regular expressions: Digging deeper
A deeper look at some of the advanced features of Perl regular expressions in UltraEdit and UEStudio
- Power tip: Perl regular expressions: Backreferences
How to use Perl regex backreferences in Find and Replace in UltraEdit
- Power tip: Multiline find and replace
Search and replace text spanning several lines.
- Power tip: Tagged expressions
"Tagging" the find data allows UltraEdit/UEStudio to re-use the data similar to variable during a replace. For example, If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello". (This example is for the UltraEdit regular expression engine.)
- Power tip: Using find/replace
UltraEdit and UEStudio give you the ability to perform a find or replace through one or more files. Learn how to use UltraEdit/UEStudio's powerful find and replace.
- Power tip: Creating Search Favorites
UltraEdit includes a Search and Replace Favorites feature that allows you to manage frequently used Find and Replace strings. Create, name, and edit your Search and Replace Favorites...
- Power tip: Search and delete lines found
UEStudio and UltraEdit provide a way for you to search and delete found lines from your files. This short tutorial provides the steps for searching for and deleting lines by writing a simple script.
- Power tip: Column Based Find and Replace
Need to restrict your search/replace to a specific column range? The column based search does just that...
- Power tip: The List Lines Containing String option in Find
The lists lines option can be a handy tool when searching because it presents all occurrences of the find string in a floating dialog box. You can use the dialog to navigate to each instance by double-clicking on one of the result lines...
- Power tip: Hide, Show, and Delete Found Lines in UltraEdit/UEStudio
Over time, many of our users have asked for the ability to hide/show lines based on a Find string... you got it! As of v16.00, you can now hide/show and even delete text based on your search criteria. The following power tip will guide you through...
- Regex Tutorial, Examples and Reference - Regexp Patterns is a website about Regular Expressions.
- Boost C++ Libraries - Perl Regular Expression Syntax is about the Perl regex syntax of the library used by UE/UES.
- RegexBuddy is a great tool if you need to construct Perl regular expressions often. It's especially good for checking your Perl regexes against real data without damaging them.
- RegexMagic is a regular expression generator which is also very helpful especially for beginners not knowing anything about Perl regular expressions.
4. Try to find the solution for your task now by yourself.
With all the informations you now have collected, you should try to find the solution for your task by yourself. Nobody becomes an expert for find/replace/regex operations by just reading a manual. Learning by doing with many trial and error runs is the only method to get practice and become finally an expert.
For security especially on replace operations on large files or more than 1 file, you should always run your replace trials on a single test file. Create a backup of the current file, for example with Make Copy/Backup in menu File (Advanced menu only). If your replace attempt does not work as expected, use the Undo function (several times, if required) or Revert to Saved in menu File (Advanced menu only).
Don't forget to enable the find option Regular Expressions in the find/replace dialog when you want to run a regular expression search/replace!
5. Try to find a help for your task/problem in the forum.
If you don't have success to find the solution by yourself, use the forum search to maybe find a topic which helps you on your specific find/replace/regex problem.
The forum search option Search for all terms or use query as entered is selected by default which combines your entered words with a logical AND. With that search option you can also run a search with your own logical rules as described left to the edit field. The option Search for any terms combines the entered words with a logical OR.
You should also select the Find/Replace/Regular Expressions forum at Search in forums: before you start your search to focus the search on topics of this forum.
If you can't find a topic which helps you in this forum, select UltraEdit at Search in forums: and run the search(es) again. Maybe your task cannot be done with a single (regex) find/replace and so a macro or script solution is required and maybe the macro or script solution you also need is posted already.
I'm pretty sure that 98% of all general find/replace questions are answered already in the forum. So don't be too lazy to find the answer for a general question by yourself. The power forum members don't like it being used as search engines for lazy users.
We expect you to "look it up"... if you can't find what you were looking for let us know (include your search criteria) and we'll try to improve the hits if your search should have found it...
6. Create a new topic with your question.
If you still don't know after 10-30 minutes of searching in the forum how to solve your problem or which search/replace string is required, create a new topic with your question. Use following guidelines for your question post:
- Enter a good topic subject summarizing your question.
You have searched before (hopefully) and so you should know now, how important a good subject is. I know, it is not always easy to find a good and short subject for a complex problem, but try your best.
- Tell us your UE/UES version and the regex engine you use.
At top of your topic write a sentence with the 2 important facts you should know already now. You can use following template:
I use UE/UES v??.?? with the UltraEdit/Unix/Perl regex engine.
Please specify the version exactly with additional bugfix version letter after the version number [abcd] and additional hotfix version number +[1-9], if you use a bugfix/hotfix version.
- Explain your problem/task detailed with examples.
Explain your problem or task as detailed as possible. Depending of the complexity of your task post a good BEFORE and AFTER example.
If your example contains preceding spaces (spaces at start of the line) or multiple spaces (more than 1 space in a sequence) enclose it in [code][/code] because in HTML preceding spaces are not displayed by the browsers and multiple spaces are displayed as single space according to the HTML standards. With [code][/code] you mark your example as preformatted text. It is required that BBCode is not disabled if you need [code][/code]. You can easily mark an example text or a code snippet as preformatted text by selecting the text and clicking on the Code button above the edit field.
If your example contains 1 or more tab characters, use a substitution character like # in your example (search for ^t and replace all with #) and write that # is a substitution for a tab character. Tabs are displayed by the browsers as single space character (normal text) or multiple spaces (preformatted text) according to HTML standards. So a tab character you enter/copy cannot be copied by a user who reads your post and wants to help you.
Any example data submitted should be real and not simplified if that's at all possible. This helps us to avoid unnecessary work on regular expressions that do work on the provided data but not on real-life data. And of course the sample should cover as many data variations as possible to avoid regex mismatches that result from false assumptions about the data structure.
You can also upload your file to a free host service or your own website and post a link to the file for download. Please, compress your file with ZIP with best compression before uploading it.
- Tell us maybe important file format information.
If your file is not an ASCII/ANSI file, please tell us the encoding of the file displayed in the area right to "line, column, clipboard" area in the status bar at bottom of the UE/UES window which can be:
U- ... UTF-16 LE (little endian)
U8- ... UTF-8
UBE- ... UTF-16 BE (big endian)
UESC- ... ASCII Escaped Unicode
nothing ... ASCII/ANSI (= no encoding)
The line termination DOS/UNIX/MAC also shown in the second box in the status bar is only important, if you have not enabled the DOS/UNIX/MAC Handling configuration setting Automatically convert to DOS format.
Other interesting pages about encodings:
- Preview your post before submitting it.
Don't enter hard returns in the edit field, if you not really want a line break. HTML browsers wrap long lines by default except in preformatted text.
If your English is not very well, that is no problem as long as it is clear enough described what you want and what is your problem.
Before you submit your topic, use the button Preview and read once again what you have written and check for BBCode usage errors. Use the edit field below the preview to make maybe required corrections and preview again or submit it. Sometimes it is better to use the Back button of your browser when you find errors in the preview and correct it in the initial edit field instead of the maybe already to HTML converted edit field of the preview page.
Last see also the topics:
Help for new forum members - read this before post anywhere!
Forum rules and how the forums are moderated/managed
Thanks for saving your and the (power) forum members' time by reading and using this readme article!
Do you know other pages which could be interesting for us?
Do you have a suggestion for a further improvement of this article?
Have you found a spelling or grammar mistake or an incorrect statement?
Yes, please post a reply to this topic and tell me what I should add or correct in the article.
If your reply was deleted by me, I have done the modification on the article according to your suggestion.
PS: This large article was written offline with UltraEdit and the BBCode tag list file from the user-submitted tag files page.