Create a file with words within the delimiters (((( and ))))

General discussions about Advanced Find and Replace
Post Reply
savesys
Posts: 3
Joined: Mon May 22, 2006 9:32 pm

Create a file with words within the delimiters (((( and ))))

Post by savesys »

Without me writing a custom program in a programming language. Does the Advanced F&R utility have a way of creating a file that can output each occurrence of the (((( & )))) delimiters and the text between them..

For example:

This is a test of ((((a utility that might do what i need it to do)))). It has alot of features but not (((sure if it can do it))))
((((test3))))
((((test4))))


So the resulting output file would look anything like this

a utility that might do what i need it to do
sure if it can do it
test3
test4

and if so, how is it done.

Thanks
Mike

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hi Mike,

Sure it's possible to do with Advanced Find and Replace.

Go to main menu - Action - Options - Batch Replace
check "Modifier S"
check "Modifier G"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid these lines,

Search for:
\A.*?\(+

Replace with:
empty

Search for:
\)+\s*\r\n\(+

Replace with:
\r\n

Search for:
\)+.*?\(+

Replace with:
empty

Search for:
\)+[^\)]*?\Z

Replace with:
empty

That's all. I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

savesys
Posts: 3
Joined: Mon May 22, 2006 9:32 pm

Thanks One More Question

Post by savesys »

It worked great, just as you said :) I am still trying to figure out how to change the delimiters. if i wanted to change the

((( and )))

to

[( and )]

How would I do so?


Thanks
Mike

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

It's easy:

Search for:
((( and )))

Replace with:
[( and )]

You even don't need to use regular expressions :)
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

savesys
Posts: 3
Joined: Mon May 22, 2006 9:32 pm

Yep I knew that.. Just curious how the expressions worked

Post by savesys »

Your original instructions worked great with this document:

This is a sample document (((Note #1))) and ((( Note #2 foobar)))

which made the file:

Note #1
Note #2


Now I was hoping to do the same with this document:
[( Note #1)] and [( Note #2 foobar)]

Where rather than ((( & ))) we have [( & )]

I can't figure out the expressions you sent me and where to make the changes in it to do as I need :(

Thanks
Mike

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

In the given expressions above:
replace all \( by \[\(
and \) by \)\]
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply