No HTML Identifier

By beau on Aug 25, 2008

I thought this was a cool way of doing it.

Do I need that else? I don't think I do ;s.

alias nohtml {
  unset %b
  var %a 1
  while (%a <= $len($1-)) { 
    if ($mid($1-,%a,1) == $chr(60)) { inc %c }
    if ($mid($1-,%a,1) == $chr(62)) { dec %c }
    else { set %b %b $+ $iif(%c < 1,$iif($mid($1-,%a,1) == $chr(32),$str($chr(32),2),$mid($1-,%a,1))) }
    inc %a
  return $iif(%b,%b,$false)


Sign in to comment.
jonabbey   -  Mar 07, 2009

Wow, noobs.

alias nohtml return $regsubex($1-,/<.+?>/g,)

guest598594   -  Aug 26, 2008

Rather than setting/unsetting %b, just use /var and make it local like %a.

beau   -  Aug 26, 2008

I need to learn regex >.< nice.

Zmodem   -  Aug 25, 2008

Hey, nice job, napalm :)

napalm`   -  Aug 25, 2008

This is just an example of using $regsubex and replacing html tags with $chr(32) "space".

Elaborate Example:

alias html.test {
var %x $1-
if (!$0) %x = $?="Sample HTML?"
if (!%x) %x = This is a test.
echo -a Test: $regsubex(%x,/(^[^<]>|<[^>]>|<[^>]*$)/g,$chr(32)) - Tags Removed: $regml(0)

It can be shortened to:

alias rm.html return $regsubex($$1-,/^[^<]>|<[^>]>|<[^>]*$/g,)

/echo -a $rm.html(Hello World!)

Produces: Hello World!

beau   -  Aug 25, 2008


EL   -  Aug 25, 2008

Heh worked for me.I'll try and use this on another socket script see how it does.Simple test = "Rate it or Hate it?"...7/10.`-.-´

EL   -  Aug 25, 2008

This a replacement for the $htmlfree alias that most use? eh i ll jus test i suppose lol.`-.-´

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.