mIRC Home    About    Download    Register    News    Help

Print Thread
Regex help #241669 11/05/13 07:14 PM
Joined: Aug 2012
Posts: 6
R
rob444 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2012
Posts: 6
Hello there!

I've read up a bit on regular expressions and I am trying to do a pretty straight forward and simple expression but I can't seem to get it to work properly.

Basically, I want it to find the word "boat" at the end, this can be done using the $ sign. However, if someone says "Can I borrow your boat?", it won't trigger at all. So I've been sitting here trying to solve it but I just can't see the solution.
To the point: I really want it to match boat or boat? at the end of the substring.

I'd appreciate some help frown!


And I've tried searching the forum by the way :P.

Last edited by rob444; 11/05/13 07:16 PM.
Re: Regex help [Re: rob444] #241670 11/05/13 07:47 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
In its simplest form this would be
/boat\??$/

Re: Regex help [Re: rob444] #241672 11/05/13 09:33 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Or:
Code:
/.+(?=boat\b)/iS
The beginning of a sentence ending with the word boat.

Re: Regex help [Re: Tomao] #241691 14/05/13 06:12 AM
Joined: Aug 2012
Posts: 6
R
rob444 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Aug 2012
Posts: 6
Thank you! smile