regex: replace )\n with \n\n

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
gcotterl
Posts: 248
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

regex: replace )\n with \n\n

Post by gcotterl »

I want to replace )\n with \n\n

Since \n is a regular expression, “Regular Expression” is ticked on the “REPLACE” screen.

The “FIND WHAT” box contains: )\n
The “REPLACE WITH” box contains: \n\n

When I click any of the “REPLACE” buttons, a dialog box is displayed saying “Found a closing ) with no corresponding opening parentheses. The error occurred while parsing the regular expression: ‘>>>HERE>>>)’”.

How do I make the above replacement?

Will the above dialog box be displayed for any other characters? If “yes”, what are they?
Last edited by AmigoJack on Mon Oct 14, 2024 1:49 pm, edited 1 time in total.
Reason: actual subject
User avatar
bbadmin
Site Admin
Posts: 878
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Dialog box

Post by bbadmin »

Brackets are special characters in regular expressions so you must escape them with a backslash if they are to match literal brackets.
gcotterl
Posts: 248
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Re: Dialog box

Post by gcotterl »

so, in my example, "Find What" would be \)\n ?
User avatar
bbadmin
Site Admin
Posts: 878
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Dialog box

Post by bbadmin »

Yes, that's correct. Lookup regular expressions in the help file for a list of the special characters.
gcotterl
Posts: 248
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Re: regex: replace )\n with \n\n

Post by gcotterl »

Thanks, I will do that.

BTW: I don't know if there's a way to mark this thread as wonderfully resolved nor how to close this item. Can you do it for me?
Post Reply