regex won't replace

English main discussion
  • Author
  • Message
Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

regex won't replace

Post by Hanging »

I'm not much good at regular expressions so am only now experimenting with this feature, but it looks like I properly constructed a regular expression because when I use it in akelpad's Replace box, akelpad finds and highlights the correct items.

What Akelpad is not doing, however, is the replacement. I wish to find certain instances of text and simply delete them (i.e. replace them with nothing). But although akelpad finds and highlights the correct text, when I press "Replace", it does nothing, merely jumps down to the next instance of relevant text, leaving the text in place rather than deleting it.

Just to make sure that akelpad didn't somehow need something in the "With" field, I put a space there, whereupon akelpad should have replaced the found text with a space. It did not do so, however, merely continued to leave the found text as it stood and just move on to the next instance.

In case it matters, the text I'm looking for is a date in the form of numerical day, a slash, alphabetical month, a slash, and numerical year, e.g. 19/Mar/95. So my regex is [0-9]+/[a-zA-Z]+/[0-9]+, and it finds and highlights the dates perfectly--but, as I say, akelpad then refuses to operate on the found text.

Is this a bug, or am I missing something?

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hanging
AkelPad 4.9.3, all works fine. Do you use AkelPad's command or script SearchReplace.js? Or FindReplaceEx.js?

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

Post by Hanging »

Skif_off wrote:AkelPad 4.9.3, all works fine. Do you use AkelPad's command or script SearchReplace.js? Or FindReplaceEx.js?
I'm using 4.8.0 and am reluctant to update for fear of losing all the customizations I've made to the toolbar & menus etc. (it was a lot of work!). I'm not using any separate command, just akelpad's normal search/replace dialog, i.e. Edit menu / Replace / [check] Regular Expressions, then type the regex in "What".

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hanging
4.8.2, AkelHistory-Eng.txt:

Code: Select all

AkelPad 4.8.2 (Mar 24, 2013)
----------------------------
Fixed: single replace with using regular expressions.


AkelPad 4.8.1 (Jan 24, 2013)
----------------------------
Fixed: single replace with using regular expressions.
You should update to 4.8.2 (minimum): http://sourceforge.net/projects/akelpad ... 204/4.8.2/ (without AkelUpdater!)
Everything will be fine :) But make a backup.

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

Post by Hanging »

Well, if I'm going to update at all, I might as well jump all the way to 493.
I just downloaded the binary zip (not the setup version). Just to be clear: I can just copy this over my current installation without losing all my customizations, correct?

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hanging
Unfortunately my English is bad and I find it difficult to talk about possible problems :( (4.8.2 should not bring problems).

P.S. I think update 4.8.0 -> 4.9.3 is an interesting task (?) and I have some spare time: Could you share your copy of the AkelPad and settings (here or in PM)?

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

Post by Hanging »

I hope the following is what you asked for. I really do have a lot of customizations. Using portable Akelpad w/INI file, hacking windows to replace Notepad. change CaretWidth from 1 to 2 with contextmenu & INI file. Have various plugins (clipboard, contextmenu, Exit [ignored], Format, lineboard, savefile, smartsel). Using Hotkeys to get rid of various keyboard shortcuts that cause me problelms. Using contextmenu to add various options and do things like put the Akelpad help files on the menu bar. Here's my custom menu-bar script:

Code: Select all

CLEAR
"&File" Index(0)
{
   "&Open..." Command(4103)
   "&Reopen" Command(4104)
   SEPARATOR
   "&Save" Command(4105)
   "Save &As..." Command(4106)
   SEPARATOR
   "Word count" Call("Stats::Main")
   SEPARATOR
   "Pa&ge Setup..." Command(4107)
   "Print Pre&view..." Command(4114)
   "&Print..." Command(4108)
   SEPARATOR
   "Recent &Files"
   {
      RECENTFILES
      SEPARATOR
      "&Clear Missing Files" Command(5001)
   }
SEPARATOR
"E&xit" Command(4109)
}


"&Edit" Index(1)
{
   "U&ndo" Command(4151)
   "R&edo" Command(4152)
   SEPARATOR
   "&Find" Command(4158)
   "Find Next Do&wn" Command(4159)
   "Find Next &Up" Command(4160)
   "&Replace (Ctrl+R)" Command(4161)
   "&Go To (Ctrl+G)" Command(4162)
   SEPARATOR
   "No-select HRt" Call("SmartSel::NoSelEOL")
   "Select &All" Command(4157)
   SEPARATOR
   "&Cut" Command(4153)
   "C&opy" Command(4154)
   "&Paste" Command(4155)
   "Multicopy"
   {
      "Toggle" Call("Clipboard::Capture")
      "Autocopy (internal only)" Call("Clipboard::SelAutoCopy")
      "Change delimiter" Call("Clipboard::Settings")
   }

   SEPARATOR
   "Sort"
   {
      "&Sort Ascending" Call("Format::LineSortStrAsc")
      "Sort On 1st &Number (Asc)" Call("Format::LineSortIntDesc")
      "Sort On &1st Number (Des)" Call("Format::LineSortIntDesc")
      "Sort &Descending" Call("Format::LineSortStrDesc")
      "&Reverse Sorting" Call("Format::LineReverse")
   }   
   "Insert C&haracter" Command(4163)
   "Insert Da&te" Command(4183)
   "Text"
   {
      "Columnar Paste" Command(4192)
      "Ta&b Indent" Command(4165)
      "&Tab Unindent" Command(4167)
      "Spa&ce Indent" Command(4169)
      "Sp&ace Unindent" Command(4171)
      "Delete &First Char" Command(4173)
      "Trim Trailing &Whitespace" Command(4174)
      SEPARATOR
      "Add HRts" Call("Format::LineFixWrap")
      "&Uppercase" Command(4175)
      "&Lowercase" Command(4176)
      "Se&ntence Case" Command(4177)
      "Title &Case" Command(4178)
      "In&vert Case" Command(4179)
      SEPARATOR
      "Change Codepage..." Command(4182)
   }
   "Newline &format"
   {
      "DOS/Windows (CRLF)" Command(4184)
      "Unix (LF)" Command(4185)
      "Mac (CR)" Command(4186)
   }

}


"&View" Index(2)
{
   "&Word Wrap" +Command(4209)
   "Text Size &+" Command(4204)
   "Text Size &-" Command(4205)
   SEPARATOR
   "&Bookmarks" Icon("%a\AkelFiles\Plugs\LineBoard.dll", 0)
   {
      "Enable" +Call("LineBoard::Main")
      SEPARATOR
      "Next bookmark" Call("LineBoard::Main::NextBookmark")
      "Previous bookmark" Call("LineBoard::Main::PrevBookmark")
      SEPARATOR
      "Set Bookmark" Call("LineBoard::Main::SetBookmark")
      "Delete Bookmark" Call("LineBoard::Main::DelBookmark")
      "Delete All Bookmarks" Call("LineBoard::Main::DelAllBookmark")
      SEPARATOR
      "Settings..." Call("LineBoard::Settings")
   }   
   "S&plit window" Command(4212)
   "&Always On Top" +Command(4210)
   "&Window mode"
   {
      "&Single-window (SDI)" Command(4261)
      "&Tabbed docs (MDI)" Command(4262)
      "&Pseudo multi-window (PMDI)" Command(4263)
   }
}


"&Tools" Index(3)
{
   -"Macros" +Call("Macros::Main") Icon("%a\AkelFiles\Plugs\Macros.dll", 0)
   "&Plugins" Command(4259)
   "&Execute" Command(4251)
}

      
"&Options" Index(4)
{
   "&General..." Command(4260)
   "&Font..." Command(4201)
   "&Colors..." Command(4202)
   SEPARATOR
   "Read Only" Command(4216)
   "Keep Left Spaces" Command(4254)
   "Watch File Change" Command(4253)
   "Preserve File Time" Command(4252)
   "Don't Open A File Twice" Command(4255)
   "Don't Open Program Twice" Command(4256)

}
"&Help" Index(5)
{
   "AkelPad" Exec("HH.exe %a\AkelFiles\Docs\AkelHelp.chm") Icon("%a\AkelFiles\Docs\AkelHlp.ico")
   "Plugins" Exec("HH.exe %a\AkelFiles\Docs\PlugHelp.chm") Icon("%a\AkelFiles\Docs\PlugHlp.ico")
   SEPARATOR
   "&About" Command(4351)
}
========================

...and here's my custom context-menu script:

=========================

Code: Select all

CLEAR


SET(8)
;select all
"" Command(4157)

;cut
"" Command(4153)

;copy
"" Command(4154)

;paste
"" Command(4155)

;del
"" Command(4156)
UNSET(8)

SEPARATOR
"Case"
{
  "&Uppercase" Command(4175)
  "Se&ntence Case" Command(4177)
  "Title &Case" Command(4178)
}
"&Sort Ascending" Call("Format::LineSortStrAsc")
"Sort On 1st &Number (Asc)" Call("Format::LineSortIntDesc")
SEPARATOR
"Insert C&haracter" Command(4163)
"Formatting"
{
  "Columnar Paste" Command(4192)
  "Ta&b Indent" Command(4165)
  "&Tab Unindent" Command(4167)
  "Spa&ce Indent" Command(4169)
  "Sp&ace Unindent" Command(4171)
  SEPARATOR
  "Delete &First Char" Command(4173)
  "Trim Trailing &Whitespace" Command(4174)
  "Add HRts" Call("Format::LineFixWrap")
  SEPARATOR
  "Change Codepage..." Command(4182)
}
Hope this is the information you needed!

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hanging
I thought that you have many more changes :)
Do you use plugin Scripts and js-/vbs-scripts? Do you use plugin Coder and custom theme and/or custom coder-file(s)?
If not, you can safely update, but read Docs/SmartSel-Eng.txt and make a backup please.

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

update plugins?

Post by Hanging »

I thought that you have many more changes :)
They seem like a lot to me... ;)
Do you use plugin Scripts and js-/vbs-scripts? Do you use plugin Coder and custom theme and/or custom coder-file(s)?
If not, you can safely update, but read Docs/SmartSel-Eng.txt and make a backup please.
I don't use any of these. However, if I update not only Akelpad itself but also the plugins that I do use, will that cause a problem? I read the new smartsel doc (just released a day ago!) and I see that it has new behaviors.

Thx.

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hm... Problems? No, nothing very serious.
Added: draw overlay array for button with Menu() method without action.
Fixed: support of the screen scale other than 96 dpi.
Changed: no icons sizing if screen scale other than 96 dpi.
Added: possibility to use 24x24 icons mode.
Added: -1 value for ArrowOverlay manual setting - use style BTNS_WHOLEDROPDOWN.

(See Manual settings in Docs/ToolBar-Eng.txt) + post & answer.

About regex: read Docs/AkelHistory-Eng.txt and Manual>>Regular expression syntax (a lot of changes).

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

updating was a pain

Post by Hanging »

Well, I updated, and it took about an hour. After I unzipped the archive into my akelpad folder, I found, unfortunately, that you were wrong: when I started the program it turned out that all of my customizations were lost, and it told me I had to update a bunch of the plugins I was using. So I did that too, then had to re-implement everything: re-initialize all the plugins w/ini files, rebuild the menus, etc.

At least the regex is working now. But there's got to be a better way to retain user customizations from one version to another.

Offline
Posts: 366
Joined: Mon Jan 10, 2011 5:28 pm
Contact:

Post by Lenchik »


Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Hanging wrote:and it told me I had to update a bunch of the plugins I was using.
I'm sorry :( I did thought that update plugins is evident need.


I tried to update 4.8.0 to 4.9.3: downloaded AkelPad-4.9.3-bin-eng.zip, PlugsPack.zip and unpacked.
My menu and toolbars* works fine, but three items with error, because plugin ContextMenu now checks the syntax more strictly:

Code: Select all

"" OpenFile("%a\AkelPad.ini"`) replace to
"" OpenFile("%a\AkelPad.ini")

-"" OpenFile("%a\AkelFiles\Plugs\Scripts\Replace.js"`) replace to
-"" OpenFile("%a\AkelFiles\Plugs\Scripts\Replace.js")

-''...'' Insert(`"\s"`, 1) replace to
-`"..."` Insert(`"\s"`, 1)
It's unnecessary or incorrect using quotes '`". I checked your menu, I did not find such errors and I did not expect any problems.

* 108 scripts, 3 toolbars (53 items) and 844 items in ContextMenu.

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

Post by Hanging »

Well, the original regex problem I posted about is solved and everything's working now, so all's well that ends well. Thanks very much for the help.

Offline
Posts: 16
Joined: Mon Mar 25, 2013 7:38 am

Post by Hanging »

Lenchik wrote:AkelUpdater (http://akelpad.sourceforge.net/ru/plugins.php) :?
Lenchik: in the fourth post on this thread, Skif_off told me explicitly NOT to use Akelupdater. I simply followed his instructions.
Post Reply