Page 1 of 1

Can't get tagged expressions to work

Posted: Fri Apr 11, 2008 2:44 pm
by mrbroschat
I successfully use this code to find what I want:

member: \n[[:print:]]*\n

Because I want to delete the trailing newline, I would like to replace with most of that (using Posix):

(member: \n[[:print:]]*)\n

This always generates an "Unmatched '(" error.

I appreciate anyone pointing out what I'm doing wrong...

Michael

Posted: Fri Apr 11, 2008 3:58 pm
by Bob Hansen
You are searching for: member: \n[[:print:]]*\n

and Replacing with: (member: \n[[:print:]]*)\n ?

I think you want to Search for: (member: )\n([[:print:]]*)\n
and
Replace with: \1\2

if you are just trying to replace the \n codes.

Note: the Search/Relace I provided are untested.

That's it!

Posted: Fri Apr 11, 2008 4:39 pm
by mrbroschat
Actually, I was just trying to join two lines, by deleting the second newline (which picks up a third line, conjoining it to the second line).

Your successful code appears to suggest that \n cannot appear within a tagged expression?

Anyway, it works wonderfully.

I used this for a search:

Code: Select all

(member: )\n([[:print:]]*)\n
[/b]

and this for a replace:

Code: Select all

\1\n\2
[/b]

So, this:

Code: Select all

member: 
 CN=Feinberg\, Michael,OU=_Users,OU=xxx,OU=xxx,OU=xxx,OU=xxx,OU=xxz
 zxxx,DC=xxx,DC=xxx,DC=xxx,DC=xxx
becomes:

Code: Select all

member: 
 CN=Feinberg\, Michael,OU=_Users,OU=xxx,OU=xxx,OU=xxx,OU=xxx,OU=xxxxx,DC=xxx,DC=xxx,DC=xxx,DC=xxx


TextPad forever...

Michael[/code]