Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Assassin
(73 posts) bio
|
| Date |
Fri 19 Mar 2004 12:22 AM (UTC) [ quote
] Amended on Fri 19 Mar 2004 12:49 AM (UTC) by Assassin
|
| Message |
* the * * has just left
*>Bob the builder has just arrived
*>Bob the builder has just left
Its capturing *> and storing that to my variable.
How can i avoid this?
Also when im attacked by a dog
Output says You are attacked by the dog!
Again its storing ! along with dog, how can i stop this
too
| top |
|
| Posted by |
Meerclar
USA (554 posts) bio
|
| Date |
Reply #1 on Fri 19 Mar 2004 06:12 AM (UTC) [ quote
] |
| Message |
| The easiest and most effective way is to make your triggers more precise. If you know the punctualtion will always be at the beginning or end of a line, modify the trigger to include the punctuation. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | top |
|
| Posted by |
Nick Gammon
Australia (18,769 posts) bio
Forum Administrator |
| Date |
Reply #2 on Fri 19 Mar 2004 09:04 PM (UTC) [ quote
] |
| Message |
Click on "convert to regular expression". For your example that gives this:
^(.*?) the (.*?) (.*?) has just left$
Then you can make it more precise. For example an optional thing like *> could be added at the start:
^(?:\*\>)?(.*?) the (.*?) (.*?) has just left$
The extra bit I added (in bold) looks for 0 or 1 occurrence of *>. I "escaped" them with a backslash because the * (at least) has a special meaning in regular expressions. The ?: at the start says to not make it a wildcard (so wildcard %1 is still the same thing).
Read up here:
http://www.gammon.com.au/mushclient/regexp.htm
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
1,762 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )