|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
help parse fonttag in asp
I am trying to pase out a font tage in asp.
I have a string newsitem and I want to find any font tag (meaning opening with <font xxxx> -- I want to save the text before in one variable and the font tag in another variable and the text after in another. I will then change the font tag. ( I want to change size to class depending on the size) Here's my code that is wrong z=instr(1,newsitem,"<font",1) if z>0 then bfont=left(newsitem,z-1) y=instr(z,newsitem,">",1) tempfonttag=mid(newsitem,z,y+z) afont=right(newsitem,y-1) response.write "tempfonttag:" & tempfonttag response.write "bfont:" & bfont response.write "afont:" & afont 'end if bfont should before the <font afont should be after > of the tag avove tempbfont should show font tag ex: <fonts name=arial size=1> Can someone start me out with this script |
|
#2
|
|||
|
|||
|
You should really be using Regular Expressions for this. if you don't know about regular expressions, they are used to define patterns and strings to find matches. The uses range from what you are trying to do, to verify email address, URLs, or phone numbers, or creating a custom markup then translating to HTML ( or some other markup like XML). As good a place as any to start learning about Regular Expressions is here: http://www.4guysfromrolla.com/webte...pressions.shtml
Knowing how to use Regular Expressions is a good skill to add to your programming know-how because it is a common tool to many programming languages. (and applications even) Read through some of the tutorials, then if you have any questions figuring out what you need to do let me know, however that link should certainly have enough info for you. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > help parse fonttag in asp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|