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
given %string = AbAcAdAe
can $regusubex be used to replace any one of the A`s?
or the 1st and 3rd only, for example?
Also, how are the fields such as \n, \a etc used.
I can't figure it out frown

cheers


-
Just because it never happened doesn't mean it isn't true.
Joined: Dec 2007
Posts: 48
K
Kol Offline
Ameglian cow
Offline
Ameglian cow
K
Joined: Dec 2007
Posts: 48
\n returns the Nth match so a simple $iif in the replacement paramter is all that's necesary.

Code:
$regsubex(AbAcAdAe,/A/g,$iif(\n == 1 || \n == 3,B,A))


Help file is pretty self-explanatory.

\n = match number, \t = match text, \a = all match items, and \A which is a non-spaced version of \a.

Last edited by Kol; 23/11/08 06:51 AM.
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
Thanks Kol, you have helped me with your reply.

I am glad that you found the help file self-explanatory.
I certainly didn't, which sort of kind of explains why I asked the question.

Thanks again.



-
Just because it never happened doesn't mean it isn't true.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I found this website most useful: http://www.regular-expressions.info/

As I was unable to find a proper download-link to "mIRC ScriptBox 1.20", and because this encompassing file is exceptionally helpful for all advanced scripters, I decided to re-host the file here [All credits go to Merlin and the "mishscript.de" community].
Among other things it features two regex tutorials, a little "library" of regular expressions, and a PCRE reference extract.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The various $regsubex markers are explained here in more detail.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard