Hi!
I have some problem with replace()
pattern(perl regex): (1,2,3,4)
code
selectString(matches[2], 1)
replace(matches[2].." [GL]")
Text from mud:
5, 6, 1, 8, 2
is
5, 6, 1 [GL], 8, 2
should be:
5, 6, 1 [GL], 8, 2 [GL]
What I'm doing wrong?
Some problem with replace()
-
- Posts: 97
- Joined: Wed Jul 25, 2012 12:35 pm
Some problem with replace()
English is not my native language. If you don't understand what im writing ask.
Ubuntu 17.04, Mudlet 3.1
Ubuntu 17.04, Mudlet 3.1
Re: Some problem with replace()
In general, triggers fire once per line. So that is looking for a single instance of 1, 2, 3, or 4. It found one, did what it was supposed to do, and then was never looked at again. You need to check "match all"... and then I believe it will be returned as a series of matches... so matches[1] and [2] will be for your first match, then [3] and [4] are for the second, and so on.