Page 1 of 1
regular expression help
Posted: Mon Jun 12, 2006 12:54 pm
by juanpgadea
Hi, i need to replace
...los jdu<sup>1</sup>
...jhs<sup>2</sup>
.
.
.
...<sup>...jgas<sup>525</sup>
with
...los jdu<FN>1</FN>
...jhs<FN>2</FN>
.
.
.
...<sup>...jgas<FN>525</FN>
I have <sup> and </sup> that i dont have to replace only replace the ones with the format <sup>number</sup>
Thanks
Posted: Mon Jun 12, 2006 1:15 pm
by SteveH
You need to perform the following search and replace:
Find:
<sup>([0-9]*)</sup>
Replace:
<FN>\1</FN>
With regular expression enabled and using POSIX regular expression syntax.
The round brackets allow you to refer to the found number between the angle brackets when creating the replacement expression.
Posted: Mon Jun 12, 2006 1:34 pm
by juanpgadea
Tnaks, i works, but in some cases i have an space after the number
<sup>12 </sup>
how can i solve these problem
Thanks
Posted: Mon Jun 12, 2006 1:59 pm
by SteveH
You need to modify the search expression to include a space repeated zero or more times.
find
<sup>([0-9]*) *</sup>
Please note there is a space after the ).
Using the previous replacement expression this will strip out any spaces after numbers i.e. <sup>2 </sup> will become <FN>2</FN>. If you want to keep the spaces then move the closing round bracket from after the first * to after the second *.
Hope this helps.