Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wildcard and Replace help req 1

Status
Not open for further replies.

aaronjonmartin

Technical User
Jul 9, 2002
475
GB
Hi guys I have a string which contains the html for a table, here is an example row:

Code:
<tr class="r2">
		<td class="c1">1</td>
		<td class="c2">12<td>
		<td class="c3">29</td>
		<td class="c4">40</td>
		<td class="c5">75</td>
</tr>

what I wish to do is replace all the <td class="c1"> with just simple <td>'s. So my idea is to use the replace function with some kind of pattern match with a wildcard for the number character. The only problem is I cant figure out how to do it. I only need to match the numerical character in the string and not the c as in the example above as all the classes start with c.

Any ideas on how to achieve this would be greatly appreciated.

Aaron




&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Have you any experience with RegEx as these can probably be used quite easily to do this task? If not, here's a good starting point:


Also, a simple "for loop" would probably work for this situation e.g.
Code:
        ' str1 is the string you are searching
        For i As Integer = 0 To 5
            str1 = str1.Replace(" class=""c" & i & """", "")
        Next


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
the for loop worked a treat thanks for the help

&quot;It's so much easier to suggest solutions when you don't know too much about the problem.&quot;
Malcolm Forbes (1919 - 1990)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top