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 ➜ About regular expression

About regular expression

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


Posted by Tkl1129   Hong Kong  (43 posts)  Bio
Date Wed 06 Jul 2011 09:16 AM (UTC)
Message
1. Whats the different between (.+?) , (.*?) ? I do serval testing but still don't know the difference between.

2. How regular expression apply to Alias? when will use that to match the things type in?

seems Alias : abc * & contenr : if xxx else xxx
it totally same case? or have other usage?

Thanks
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 06 Jul 2011 09:55 AM (UTC)
Message
Quote:

1. Whats the different between (.+?) , (.*?) ?


.+ matches one or more of any character.

.* matches zero or more of any character.

The ? means "non greedy". In the case of .* the least number it could match would be zero. In the case of .+ the least number it could match would be one.

Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.


Scroll down to "greedy matches".

I don't understand the second question. Can you give an example?

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