newb needs help: Simple regular expression

General questions about using TextPad

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

Post Reply
nyc2002
Posts: 4
Joined: Thu Jul 24, 2003 12:39 pm

newb needs help: Simple regular expression

Post by nyc2002 »

Hello:

a bit of a newb when it comes to regular expressions -- so forgive me if this is covered elsewhere -- i did a search on this forum but could not find any info.

I need to replace some <br> tags that have random spacing, and also comes in various numbers, but always follow text, and end with a comment tag.

so for example, a document might have:
Some text<br>
<br>
<br>
<!-- comment tag -->
or
Some text <br>
<br>
<br>
<br>
<!-- comment tag -->
and the <br> might have a tab space in front of it as well.

any ideas ?

I know the [[:space:]] command should help, but using it to find more than one space hasn't worked for me ...

thanks.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Replace

Code: Select all

^\t*<br>\n<!--
by

Code: Select all

<!--
repeat until nothing is found...
nyc2002
Posts: 4
Joined: Thu Jul 24, 2003 12:39 pm

Post by nyc2002 »

thanks MudGuard:

but I can't seem to get it to work. It doesn't actually find anything.

I'm looking at one of my documents, and it has:

Code: Select all

	12401<br>
				<br>
			<br>
			<br>
  	      	<br>
            <!-- comment tag -->
I have regular expression checked off :)

does the comment tag need to be escaped perhaps ?

thanks.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

You did not mention that the comment might have tabs before it as well.

Search for

^\t*<br>\n\t*<!--
nyc2002
Posts: 4
Joined: Thu Jul 24, 2003 12:39 pm

Post by nyc2002 »

MudGuard --

feel free to ignore this post, since you have offered more than I deserve :)

but I still can't get this damn thing to work, and I have 400+ files I need to update.

Just so you don't think I'm totally crazy, I'm attaching the file with the sample.

http://www.polystager.com/sample.txt


many thanks!
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

ah, mixed tabs and spaces...

Try

Code: Select all

^[\t ]*<br>\n[\t ]*<!--
nyc2002
Posts: 4
Joined: Thu Jul 24, 2003 12:39 pm

Post by nyc2002 »

thanks !!

much appreciated.
Post Reply