Page 1 of 1

replace numbers to bold

Posted: Mon Dec 10, 2001 1:11 am
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.

Re: replace numbers to bold

Posted: Mon Dec 10, 2001 9:36 am
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

Re: replace numbers to bold

Posted: Tue Dec 11, 2001 2:28 am
by Aykut
thanks..man..it works..;-))

Re: replace numbers to bold

Posted: Wed Dec 12, 2001 10:43 pm
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.

Re: replace numbers to bold

Posted: Thu Dec 13, 2001 11:50 am
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