• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

perhaps a little regex help

Fjord

n00b
Joined
Oct 7, 2004
Messages
44
all,

As i am sure we all know, MS products turn out horrible code. At the moment it is my job to clean up said code leaving standard html (sucks to be me). One thing that would help me would to be able to do a regex search and replace. For instance:

i have this line:
<td width="0" height="0" class=xl336909 style='border-top:none;border-left:none; width:140pt'>

I want to have a regex expression that would take that line and turn it into:
<td>

the only idea i had was (using vi)
:%s/<td.*>/<td>

this selects the entire line after <td ... not what i want. any ideas?
 
'*' is greedy, so it's going to slurp up everything until the last '>' in the line when used with '.'.

Code:
:%s/<td[^>]*>/<td>
should work even in old-school Vi, though I only have Vim here so I can't check for sure. The [^>] is an negated character class atom that means "match everything except for a '>'", as opposed to '." which means "match everything".

In case you are using Vim , try ":help 27.4" for a couple other ways to limit the matches (found via ":help regex").
 
dude, you rock! that was it. that just saved me days for hand editing.
 
This shows a more generic RE for finding html tags, which you can then modify as you see fit to find only certain tags.

It looks like the intent is to remove the formatting, are you going to let another program add formatting? Code it by hand, or leave it to the client browser? Just curious...
 
Back
Top