User: Guest


Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Raduga (English)
Song Requester

REQ: Regular Expressions in "Replace with" text field

Posted on: SuperEdi

From Message

Tomi Häsä

2007-03-20 14:01:26

REQ: Regular Expressions in "Replace with" text field

Here's my feature request: with the "Replace" function of SuperEdi I would like to be able to use regular expressions not only in the "Find what" text field but also in the "Replace with" text field.

Now I need to copy the text from SuperEdi to Writer to be able to use regular expressions in the replacing text also.

Wolfgang Loch

2007-03-20 18:21:28

Re: REQ: Regular Expressions in

Can you please give some examples of what you are trying to do? Thank you.

Tomi Häsä

2007-03-20 19:24:56

Re: REQ: Regular Expressions in

With a text editor I like to create web documents that can read even with the text-only browser lynx, and which are W3C compliant, and which can be easily copy-pasted without modification back to Google Groups if I want to quote my own text from the FAQs or from the news quotes pages:

So I'm now copy-pasting my articles from my Google Groups postings, which are mostly posted to the forum (most of them have been saved to text files, so I don't need to search for them one-by-one from the forum):

to HTML files as another archive to my own Google Page Creator web site. Maximum line length for Google Groups postings is about 71 characters:

But just in case the Google Groups line length limit changes, I'm using 70 characters. I have used TED Notepad to make every line 70 characters long at maximum, but TED Notepad adds a space to the end of paragraphs, so the "70 character" lines become 71 character lines.

So, I needed to use to replace 2239 occurrences of space & break with tabs and then delete the tabs from the file (the file itself is not quite ready yet at the moment, but I thought you would like to see an example what I'm talking about -- the spaces at the end of paragraph lines have already been removed, so you can't see them):

By hand that would have been a bit tedious. :)

Wolfgang Loch

2007-03-20 20:24:59

Re: REQ: Regular Expressions in

Thank you for the lenghy explanation. However, I still don't understand which regular expression you would like to apply.

However, I got the impression that you want to solve a quite complex, very specific problem. You may consider writing a SuperEdi script for this task and add it to the Tools/Scripts menu or to the Quickstart toolbar. Supported scriping languages include Perl, JScript and VBScript. Each of these languages supports regular expressions.

Tomi Häsä

2007-03-20 21:09:22

Re: REQ: Regular Expressions in

I can do this with SuperEdi: press Ctrl+h, press "Regular Expression" button, select "\r\n Line Break" for "Find what:" text field and add a space before the line break.

But if I put "\r\n" (without quotes) to the "Replace with:" text field, the space & break will be replaced with "\r\n" (without quotes) in the text when in fact I want to replace space & break with a break (to get rid of the extra space before the line break).

Thanks for suggesting writing a SuperEdi script. For some reason I thought you can only use ready-made scripts. Maybe you could advertise or hint some subtle way the possibility to create your own scripts in the "Tools," "Scripts" menu for those who don't read the manuals. :)


2007-03-26 08:36:56

Re: REQ: Regular Expressions in

Just want to show an example which work in Textpad

Example 1

suppose there is one word/line in Editor and i want to distribute each character in new line


The regular expression would be (using POSIX)

Find (.)
Replace \1\n


Example 2

There are several variables like

var abc
var abc1

I want to add some text after each line (using POSIX)

Find ^([^.]*)(.*)
Replace \1 = new Object()


var abc = new Object()
var abc1 = new Object()

and a lot other uses of supporting regular expression in replace functionality.


2007-03-27 06:34:28

Re: REQ: Regular Expressions in

Replacement Expressions

Post a reply to this message: