How can I limit the search between specific tags?

General questions about using TextPad

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

Post Reply
hayworth
Posts: 3
Joined: Sun Oct 07, 2012 9:44 am
Location: España

How can I limit the search between specific tags?

Post by hayworth »

How can I limit the search between specific tags?

In this text:

Code: Select all

<p class="txt" xml:lang="es"><span class="lookforthistag">Change These Words</span><span class="txt">, Roland (2005). </span><span class="crva">El grado cero de la escritura. </span><span class="txt">Seguido de </span><span class="crva">Ensayos críticos. </span><span class="txt">Siglo XXI. Madrid. </span></p>
I am triying to select only:

Code: Select all

<span class="lookforthistag">Change These Words</span>

I am using:

Code: Select all

<span class="lookforthistag">\(.*\)\ </span>

but the test Textpad selected in texpad is more than

Code: Select all

<span class="lookforthistag">Change These Words</span>
, it not stop in

Code: Select all

</span>
, it stops in the last

Code: Select all

</span>
of the line.


I am triying to select this specific tag

Code: Select all

<span class="lookforthistag">Change These Words</span>
[¡the words are different in each case!]

and change for

Code: Select all

<span class="txt">C</span><span class="small-caps">hange </span><span class="txt">T</span><span class="small-caps">hese </span><span class="txt">W</span><span class="small-caps">ords</span>
I need to put a specific tag for the first letter of each word and other tag for the rest of the word.

Thank you.
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

You're asking two different questions and I can only help with the first one.

To select the "lookforthistag" span element, you can use: <span class="lookforthistag">[^<]*</span>

The .* expression is greedy, so it matches as much text as it can.

However, this doesn't actually help with your second question, which is to add the "txt" and "small-caps" tags into the content of the element. I'll leave that for someone else to tackle...
hayworth
Posts: 3
Joined: Sun Oct 07, 2012 9:44 am
Location: España

Post by hayworth »

Thank you, ak47wong. It works perfectly...
Post Reply