mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2006
Posts: 5
V
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
V
Joined: Oct 2006
Posts: 5
its hard to regsub strings that containts multilines and long texts (>950chars) for example persing bbcode or html tags to make replace [ url=http://...] and other tags to look better when shown in irc chat window:)
and it would work like that: $regsubbin(&inputvar,/regexmask/,&outputvar) or
$regsubbin([name],&inputvar,/regexmask/,&outputvar) Returns N, the number of substitutions made, and assigns the result to &outputvar

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I would absolutely love it.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Agreed smile always wanted it.

Now if mIRC were to quote strings we could easily pass binvars to any identifier :P as the difference between strings, identifiers and binvars could be made by judging the first character suplied to it.

Last edited by Mpdreamz; 20/10/06 01:50 PM.

$maybe
Joined: Oct 2006
Posts: 166
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
this would be great.


Kind Regards, blink
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
And break every script in existence in the process :tongue:

Maybe with something like a preprocessor instruction at the top of the file..

Code:
option quotedstrings on


I think it'd be far too much trouble though.

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
yah this is quite a cool idea even though i've never personally had a use for it. has a workaround ever been made in the past?


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2006
Posts: 14
H
Pikka bird
Offline
Pikka bird
H
Joined: Oct 2006
Posts: 14
Yes very simply write the binvar to a file and use /fseek -r

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
yes, that's the obvious method :P but that would be more relared to a $regex equivalent, not $regsub. handling substitutions makes it a lot more complicated


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
/fseek with -r does not look at the file as one long string, it attempts a line by line match, hardly the same as when you would use a regex/regsub on a file read into a binvar.

Please observe the following alias:

Code:
alias test {
  var %file = FiberOP $+ $ticks
  write %file $+(a,$lf,b)
  bread %file 0 $file(%file) &bin
  echo -a > String: $bvar(&bin,1-) ** Regex: $regex(%file,$bvar(&bin,1-).text,/(a\s+?b)/) ** Regml: $regml(%file,1) 
  .fopen %file %file
  fseek -r %file /(a\s+?b)/
  echo -a > Regml: $regml(1) 
  .fclose %file
  .remove %file
}

Or to put it in layman's terms, you can't match patterns that span accross multiple lines with /fseek -r, whereas this is no problem if a $regex/$regsub would exist with binvars.

If $regex/$regsub(ex) would support binvars, that would be bliss. I'd read the html file into a binvar, use a $regsub to remove all newlines, and then I can handle the entire file as one long string without needing to worry about the html being cut to a new line. And actually, it would open up a whole new method of manipulating data in a file...


Gone.
Joined: Oct 2006
Posts: 5
V
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
V
Joined: Oct 2006
Posts: 5
problam is that with longer strings you got string to long messages, that is very annoyng me and many others, beacuse of that you have write long scripts read data into &binvar, explode into short strings and many other things (depends on what you wanna do with string)

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You should have been able to deduce from my post that I feel the same way grin

In fact, anyone who is enthousiastic about this feature knows very well the reasons for wanting this, thus their enthousiasm...

Btw, I've made a feature suggestion like this already back in 2004, and I'm sure others have suggested it before me (Raccoon in 2003), but no luck so far. Rest assure, you are not the only one who has wanted this for a long time, for all possible benefits it will release.


Gone.

Link Copied to Clipboard