Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Matching blocks of text and outputting to notepad

Matching blocks of text and outputting to notepad

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Tsheller   USA  (14 posts)  Bio
Date Fri 18 May 2007 08:18 AM (UTC)

Amended on Fri 18 May 2007 10:08 AM (UTC) by Tsheller

Message
I would like to have some kind of script or trigger to match on several lines for specific data, and then write the matched data in a specific format to a notepad file, as an example..


>score
St 100(100)/+ 69 Co 100(100)/+ 45
Qu 100(100)/+ 61 Ag 100(100)/+ 61
Pr 77( 77)/+ 16 Sd 100(100)/+ 25
Em 100(100)/+ 40 Me 80( 80)/+ 23
In 93( 93)/+ 25 Re 97( 99)/+ 48

I would like the output to simply spot the St, Qu, Pr, etc, and then write it out as:

100(100)+69, 100(100)/+61, 77(77)/+ 16, and so on. Anyone know the best or easiest way to do this?

Edit: Something I missed the first time is that there are some things I -don't- want it to match.
Top

Posted by Martijn   (20 posts)  Bio
Date Reply #1 on Tue 22 May 2007 10:29 PM (UTC)
Message
St 100(100)/+ 69

is this what you would be looking for (in regex)?

^(St|Qu|Pr|etc) (\d{2,3})\((\d{2,3})\)/\+ (\d{2,3})

here, %2 would hold "100", %3 would hold "100", %4 would hold "69", and %0 would hold "St 100(100)/+ 69" where to send if from there I wouldn't know, but it seems you do. this would trigger on the following in words:

(start of the line)(Sr or Qu or etc) (2 or 3 numbers)((2 or 3 numbers))/+ (2 or 3 numbers)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 23 May 2007 12:59 AM (UTC)
Message
Did you read http://mushclient.com/faq points 23 and 37?

- 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.


13,496 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.