| View previous topic :: View next topic |
| Author |
Message |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Jan 02, 2009 7:34 pm Post subject: [SOLVED] retrieving certain objects |
|
|
hi ^^
to explain what i like to do:
i catch a line with my bot which comes from a news system but only want to retrieve the news posters nickname - problem is that the news posters nickname sometimes consists of one or two names, in example:
"news added: sony increased sale rates on playstation 3 poster: derrick date: 2009-01-01" <-- one name which i can easily catch with lindex
and
"news added: sony increased sale rates on playstation 3 poster: dick tracy date: 2009-01-01" <-- two names
is there a way to easily retrieve only the posters complete nick?
or is there a way to string match from a special char to a special char?
hope my explanation isnt that bad 
Last edited by raider2k on Fri Jan 02, 2009 8:38 pm; edited 1 time in total |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Jan 02, 2009 8:25 pm Post subject: |
|
|
You could use a regexp to get everything between "poster: " and " date:" using something sililar to the following tclsh examples :-
% set data "news added: sony increased sale rates on playstation 3 poster: dick tracy date: 2009-01-01"
news added: sony increased sale rates on playstation 3 poster: dick tracy date: 2009-01-01
% regexp {poster: (.+?) date:} $data -> nick
1
% return $nick
dick tracy |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Fri Jan 02, 2009 8:38 pm Post subject: |
|
|
geesh!
that worked
thanks very much for your help  |
|
| Back to top |
|
 |
|