wiki:Features/RegexEditor

Version 21 (modified by szabgab, 4 years ago) (diff)

--

Description

Padre provides an easy way to build and analyze regular expressions compatible with Perl 5.

The Regex Editor can be used for building and debugging regular expressions.

  1. You can open the Regex editor via Tools -> Regex Editor
  2. At the top you will see 5 check-boxes for the modifiers of the regex
  3. The first window called Regular Expression is where you can type in the regex. By default you will see \w+ in there
  4. The Replace with text contains Baz and is interesting when you are trying to build a substitution
  5. Original text is the place where you should type in sample strings you'd like to match. By default it contains Foo Bar
  6. Matched text is a copy of the Original text with the actual match (in the default case Foo) being red and underline
  7. Result from replace contains the result of a substitution. By default it shows. Baz Bar

regex editor in 0.84

Tickets

Ticket Resolution Summary Owner Reporter
#1171 Regex Editor highlighting seems to be broken szabgab szabgab
#1170 Add undo to the regex editor szabgab
#1169 Regex Editor does not understand \Q szabgab
#1140 fixed Regex editor reverses flags on insert markkiteflyer
#1072 Regex editor: help button zenogantner
#1032 fixed Regex Editor: Escape sequences don't work in "Result from replace" dandv
#960 regex editor improvement ideas jdv79
#926 fixed Escape key does not work most of the time in the regex editor zenogantner
#925 (wishlist) offer Regex Editor in context menu when cursor is on a regular expression zenogantner
#924 (wishlist) user-defined regex library, previously defined regexes, and Regexp::Common in the Regex Editor zenogantner
#923 fixed (wishlist) special (tab) characters should be also available in regex editor zenogantner
#922 fixed Regex editor keeps first language after language change. zenogantner
#921 fixed regex syntax error leprevost
#899 (wishlist) Preferences: Use regex editor for the TODO regex azawawi zenogantner
#760 Clone and Substitution mode of txt2re kthakore
#542 fixed regex editor szabgab

Test Case

The regex editor currently provides a single way to build both regexes and substitutes.

  1. Regex \d+ Text: Foo 123 Bar , Expected Match: 123
  2. Regex \d* Text: Foo 123 Bar , Expected Match: empty string before F and to give a warning accordingly (in 0.84 this marks the whole string)
  3. Regex empty, Text: Foo 123 Bar , Expected Match: nothing (in 0.84 this marks the whole string)
  4. Regex (?=b) , Text: abc , Expected to Match the empty string between a and b.

TODO

For ideas install kregexpeditor or regexxer on Linux or try Regex Coach: http://weitz.de/regex-coach/ on Windows See also http://www.regexbuddy.com/

  • Support various versions of the perl 5 regexes (5.8, 5.10, 5.12 etc)
    • There should be an option (a selector on this window) to decide which regex dialect to support
    • (That is, there are certain new features in the regex engine and information about then under the buttons should be displayed along witht the minimum version required)
  • Support Perl 6 style regexes
  • Probably the regex and substitute part should be separated. At the top should be
    • Regular Expression
    • Original text
    • Matched text
    • checkbox to enable/disable substitution
    • Replace with text window
    • Result from replace window
  • Also test the Insert button in both match and substitute
  • Allow the user to change the delimiters of the regex from to {} in the editor already

Attachments (1)

Download all attachments as: .zip