mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
The following code posted elsewhere on this site strips out html tags
Code:
alias hst {  return $regsubex($1,/<.+?>/g,) }

I have modified it as follows,
Code:
alias braces {  return $regsubex($1,/{.+?>}g,) }

having renamed it and replaced '<' & '>' with '{' & '}'.

The new alias performs a similar function to that of $hst, but strips out 'tags' delimited by curly brackets instead of tags delimited by angle brackets. However, the alias fails to perform as I would wish when there is a space between the opening '{' and the contents of the 'tag'. Any advice would be appreciated.


-
Just because it never happened doesn't mean it isn't true.
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Code:
//echo -a $regsubex({he llo} you {} there {tag} whatsup?,/{.*?}/g,)


$maybe
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
As simple as that? Thankyou.


-
Just because it never happened doesn't mean it isn't true.
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
oh dear. $Maybe I congratulated you too soon.
Your example works fine as an alias, but when called as a custom identifier I still have the same problem.
eg. if i have the following alias
Code:
alias braces {  return $regsubex($1,/{.*?>}g,) }
then this input
Code:
//say $braces({he llo} you {} there {tag} whatsup?)
it works fine.
But make the input
Code:
//say $braces({he llo } you {} there {tag} whatsup?)
and an error is returned.

mIRC doesn't handle spaces very well, does it?


-
Just because it never happened doesn't mean it isn't true.
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
you seem to have modified the regex a tad:
Code:
alias braces return $regsubex($1-,/{.*?}/g,)


However your still going to have issues with:

Code:
//echo -a $braces({ he llo } you {} there {tag} whatsup?)


This is due the t "}" with spaces around it makes mIRC think it needs to close down.

i.e
Code:
//tokenize 32 a b c d e f g { if ($1-) echo -a $1- }

is the same as
Code:
//tokenize 32 a b c d e f g | if ($1-) echo -a $1-


So passing the parameters yourself is going to be crude:

Code:
//tokenize 32 $({,) a $(},) <-- is that being stripped ? | echo -a $braces($1-) orginal: $1-


but whenever "{ tag }" is put in an $ident by mIRC itself (i.e in $1- in on text event or $did() in a dialog) you wont have to escape { and }

i.e:
Code:
//tokenize 32 $({,) a $(},) <-- is that being stripped ? | var %x = $1- | echo -a $braces(%x) 


Hope that helps smile


Whats actually funny about "}"
Code:
alias tr { tokenize 32 $({,) a $(},) <-- is that being stripped ? } set -l %x $1- } echo -a %x }


this works "fine" all be it you have to use set -l because it wont be sent in the aliases scope but in the main mIRC's scope , just as /var doesn't work in the editbox of mIRC.

Code:
alias tm {
  var %x = $$1 * 3
} return %x


also works as expected this is because mIRC doesn't really parse by { } i.e it wont check while parsing a script if the correct ammount are used. It just keeps streaming the alias untill it can't no more.

Last edited by Mpdreamz; 13/12/07 12:14 PM.

$maybe
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
Yes. I did 'did' modify the tag frown

Thanks again smile


-
Just because it never happened doesn't mean it isn't true.

Link Copied to Clipboard