Tapatalk

Readme for the Find/Replace/Regular Expressions forum

Readme for the Find/Replace/Regular Expressions forum

6,685587
Grand MasterGrand Master
6,685587

    Mar 10, 2007#1

    Please read this article first before you write a question in the Find/Replace/Regular Expressions forum!


    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 on ribbon/menu File on About at bottom, or on right side of ribbon bar on Support and next on menu item About, or in menu Help on menu item About depending on version of UE/UES and used user interface mode.
    On not using a very old version of used UE/UES the version string can be selected with pointer and copied with Ctrl+C into clipboard for pasting the version information next with Ctrl+V into the post.

    The exact version of UE/UES is essential if you think you have found a bug (coding error in program code) and you want to verify it by other users.
    Real bugs must be reported by email to UltraEdit support as explained on technical support page.

    Attention!

    All version related information below are for UltraEdit and UEStudio for Windows. There is no version related information available for UltraEdit for Linux/Mac because the author of this announcement does not have a Linux or Mac computer.


    2. Determine the regular expression engine.

    Most complex find/replace operations can be executed only with a regular expression (short: regex) find/replace. But depending on your version of UE/UES up to three different regex engines are supported by UE/UES. To determine the currently used regex engine, do following:
    • 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 window except for Find/Replace in hex edit mode (always UltraEdit regex engine). If you cannot see the regex options, click on button Advanced (UE < v21.10 and UES < 14.20) or on button with a gearwheel symbol (UE ≥ v21.10 and ≥ UES 14.20) in the window.
       
    • 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 three regex engines for your choice in the right panel:

      Perl compatible Regular Expressions
      UltraEdit style Regular Expressions
      Unix style Regular Expressions
       
    • 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 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.
       
    3. Read the help pages for find/replace/regular expressions.

    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. Press key F1 to open the help for the currently active find/replace dialog if there is no button Help. The appropriate help must be opened manually in help of UE/UES if the find/replace window is docked on any side of UE/UES main window (view window instead of dialog window).

    The find/replace help pages contain important information for usage of find/replace like a description for all options and a table with special characters. Please also read the help page for regular expressions linked on the find/replace help pages depending on the regex engine you use if you must do a complex find/replace and so must perform a regex find/replace. The tables are complete for UltraEdit and Unix regex. But the Perl regex table is just a very brief overview.

    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 literal 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 literal character inside.

    You should also look on the list of UltraEdit frequently asked questions and the Power Tips on this website.

    Pages on the UltraEdit website which are maybe interesting for you:
    Interesting pages on other websites especially for Perl regular expressions:
    • RexEgg is a website about regular expressions with very good and detailed information with tutorials and examples.
       
    • Regular Expressions is another website about regular expressions with very good regex tutorials, examples, and reference as well as regex patterns.
       
    • Boost C++ Libraries - Perl Regular Expression Syntax is about the Perl regex syntax of the library used by UE/UES for Windows. It is just a small summary and not complete.
       
    • RegexBuddy is a great tool if you need to construct Perl regular expressions often. It is 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 information 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. If your replace attempt does not work as expected, use the Undo function (if required several times) or Revert to Saved in menu File.

    Don't forget to enable the find option Regular expressions in the find/replace window 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 am quite sure that 98% of all general find/replace questions are answered already in the forum. So please do not 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 do not know after 10 to 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. 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 two key facts you should know already now. You can use following template:

      I use UE/UES v????.?.0.?? with the UltraEdit/Unix/Perl regex engine.

      Please specify the version exactly as shown in About window. The version string can be selected in About and copied with Ctrl+C when not using a very old version of UltraEdit.
       
    • 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 leading spaces (spaces at start of the line) or multiple spaces (more than 1 space in a sequence) select all lines of the example and click on last but one Code symbol button above edit area because in HTML leading spaces are not displayed by the browsers and multiple spaces are displayed as single space according to the HTML standards. You format your example as preformatted text with formatting your example as code block. It is required that BBCode is not disabled on Options tab below edit area if you need code block formatting or use any other formatting.

      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. 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 is 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 or RAR with best compression before uploading it. Small ZIP or RAR archives can be also attached to the post itself.
       
    • Tell us maybe important file format information.

      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 encoding / code page of active file is displayed in status bar since UE for Windows v19.00 and UES v13.00 without the abbreviations above if not using basic status bar making it even easier to get information about encoding / code page of file.

      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.

      Do not 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 forum announcements:
      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.
    I have done the modification on the article according to your suggestion when your reply was deleted by me.


    PS: This large article was written offline with UltraEdit and the BBCode tag list file from the user-submitted tag files page.