void main() {
matcher m;
string raidlog = visit_url("shop.php?whichshop=generalstore");
m = create_matcher("was a ([a-z]*)", raidlog);
if (find(m)) {
print ("test");
print(group(m,1));
}
void main() {
matcher m;
string raidlog = visit_url("shop.php?whichshop=generalstore");
m = create_matcher("was a (\\w*)", raidlog);
if (find(m)) {
print ("test");
print(group(m,1));
}
" " isn't matched by \w or [a-z]+. Similarly, "." isn't matched by any of those groups.
I'd probably use something like [^<]+ to match everything until the start of the next HTML tag.
edit: also, note that m.group(1) will only return the first capturing group, i.e. what's in the first set of parentheses.
m = create_matcher("was ([^<]+)", raidlog);
if (find(m)) {
print ("test");
print(m);
print(group(m,1));
map_to_file saves a map to a file not a string. Create a map such as...int[string] mymap. Fill the map with the strings you want in the file. Then use map_to_file(mymap,"file.txt") to save your map of strings to the file.
Code:matcher m = create_matcher("was ([^<]+)", raidlog); [COLOR=#ff0000][B] string[int] mymap; <--- define a map to store the string(s) [/B][/COLOR] /* " if (find(m)) " will find the first match to the pattern defined with create_matcher() " [B]while (find(m))[/B] " will keep looking through the 'raidlog' text and find all matches to the pattern. */ if (find(m)) { print ("test"); print(m); print(group(m,1)); [COLOR=#ff0000][B] mymap[count(mymap)] = group(m,1); <--- put it in a map -- once with [/B][/COLOR][COLOR=#0000cd][B]if(find(m))[/B][/COLOR][COLOR=#ff0000][B] -OR- repeatedly with [/B][/COLOR][COLOR=#0000ff][B]while(find(m))[/B][/COLOR] } [COLOR=#ff0000][B]map_to_file(mymap,"myfile.txt"); <--- after done building map, save map to a file[/B][/COLOR]
Now, how can I put that into a map?
int NE= count(test);
test[NE].message= message;
test[NE].time_ = to_int(now_to_string("HHmm"));
Map_to_File(test,"pazsox.txt");
}
{
string [int] my_list;
file_to_map("pazsox.txt", my_list);
for i from 0 to (count(my_list) -1) {
print(my_list[i];
}
Presumably you meant to use the record you defined, e.g. as part of the definition of my_list?
PHP:note [int] my_list;
I'm sure he did. Duh.
{
string [int] my_list;
file_to_map("pazsox.txt", my_list);
for i from 0 to (count(my_list) -1) {
print(my_list[i];
}