Find/Replace issue with wildcard

W

Will

Hello My Friends,
Does anyone know an easy way to do the following:

I have a list of data:
..ts1p0{position:absolute;left:264px;top:56px;}
..ts1p1{position:absolute;left:1px;top:52px;}
..ts1p2{position:absolute;left:64px;top:52px;}
..ts1p3{position:absolute;left:214px;top:36px;}
....


and I want to replace
<div class="ts1p0">
<div class="ts1p1">
<div class="ts1p2">
<div class="ts1p3">
....

with
<div style="position:absolute;left:264px;top:56px;">
<div style="position:absolute;left:1px;top:52px;">
<div style="position:absolute;left:64px;top:52px;">
<div style="position:absolute;left:214px;top:36px;">
....

Thanks a lot!!

-- Will
 
D

Doug Robbins

Don't see where the "<div class=" features in your list of data, but with

(.ts1p[0-9]{1,}\{)(position:absolute;left:[0-9]{1,}px;top:[0-9]{1,}px;\})

in the Find what control of the Edit Replace dialog and with

<divstyle="\2">

In the replace with control,

..ts1p0{position:absolute;left:264px;top:56px;}
..ts1p1{position:absolute;left:1px;top:52px;}
..ts1p2{position:absolute;left:64px;top:52px;}
..ts1p3{position:absolute;left:214px;top:36px;}

will be replaced by

<divstyle="position:absolute;left:264px;top:56px;}">

<divstyle="position:absolute;left:1px;top:52px;}">

<divstyle="position:absolute;left:64px;top:52px;}">

<divstyle="position:absolute;left:214px;top:36px;}">



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jezebel

For pIndex = 1 to however_many_items_in_your-datalist

pSource = Choose(pIndex,
".ts1p0{position:absolute;left:264px;top:56px;}", _
".ts1p1{position:absolute;left:1px;top:52px;}",
_
".ts1p2{position:absolute;left:64px;top:52px;}",
_
:
)

pSearch = "class=" & chr$(34) & mid$(pSource, 2, 5) & chr$(34)
pReplace = "style=" & chr$(34) & mid$(pSource, 8, len(psource)-9) &
chr$(34)

Find and Replace: pSearch, pReplace [Assume you know how to do
this bit]

Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top