replace numbers to bold

General questions about using TextPad

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

Post Reply
Aykut

replace numbers to bold

Post by Aykut »

hi...
i have 7000 numbered and sorted line onto a html file.like this;
200<............
989 - brabrabra
989 - brabrabra
989 - brabrabra
989 - brabrabra
..........>7000

and a want make all line numbers to bold..like this;
200<............
<b>989</b> - brabrabra
<b>989</b> - brabrabra
<b>989</b> - brabrabra
<b>989</b> - brabrabra
..........>7000

how to make this with Expressions?
thanks for helps.
Andreas

Re: replace numbers to bold

Post by Andreas »

Find:
^[0-9]+
Replace by
<b>&</b>

^ means to start search at start of line
[0-9] searches for all the characters in the [], in this case the digits 0 to 9
+ means: find at least one and as many as possible of what is left of the + (in this case, the digits)
together: find as many digits as possible at the beginning of the line

<b> is the start tag of the HTML bold element
& stands for the complete stuff that was found by the expression in the find box
</b> is the end tag of the HTML bold element
Aykut

Re: replace numbers to bold

Post by Aykut »

thanks..man..it works..;-))
Alex Angelopoulos

Re: replace numbers to bold

Post by Alex Angelopoulos »

You have an excellent way of explaining things Andreas...Hopefully they will integrate some of your examples into an upcoming version of the Help files.
Andreas

Re: replace numbers to bold

Post by Andreas »

Not that excellent - I forgot that <b> has to be HTML-encoded to be visible.

So what is bold above should read:

replace by
<b>&</b>

and in the explanation of the RE:

<b>is the start tag of the HTML bold element
& stands for the complete stuff that was found by the expression in the find box
</b> is the end tag of the HTML bold element
Post Reply