AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoHotkey Help Manual - RegEx Quick Reference: Addition

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
TheGood



Joined: 30 Jul 2007
Posts: 372

PostPosted: Tue Jan 13, 2009 4:54 am    Post subject: AutoHotkey Help Manual - RegEx Quick Reference: Addition Reply with quote

One feature I've used quite often, which I found through the linked pcre.txt file, is the \K option, which resets the match start. I think this should definitely be in the help file because it is extremely useful (it is similar to a lookbehind assertion, except much more flexible). I know that the quick reference is only meant, well, for quick references. But all I'm suggesting is an entry in that nice "Commonly Used Symbols and Syntax" table. Nothing big.

Here are the details about it from the PCRE file:

Quote:
Resetting the match start

The escape sequence \K, which is a Perl 5.10 feature, causes any previ-
ously matched characters not to be included in the final matched
sequence. For example, the pattern:

foo\Kbar

matches "foobar", but reports that it has matched "bar". This feature
is similar to a lookbehind assertion (described below). However, in
this case, the part of the subject before the real match does not have
to be of fixed length, as lookbehind assertions do. The use of \K does
not interfere with the setting of captured substrings. For example,
when the pattern

(foo)\Kbar

matches "foobar", the first substring is still set to "foo".
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 1994
Location: GERMANY

PostPosted: Tue Jan 13, 2009 2:11 pm    Post subject: Reply with quote

Thank you very much for this hint, I was looking for this option and thought it is note existing.

I just noticed that in help file wrote:

AutoHotkey's regular expressions are implemented using Perl-compatible Regular Expressions (PCRE) from www.pcre.org.


Does it mean all options from www.pcre.org are working in AutoHotkey?

I did have a look in the past but it was quite a lot information.
As I never used RegEx before it was just over my head and I've forgotten it. Embarassed

It would be really great to have a full Regex referrence in AutoHotkey help.
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
TheGood



Joined: 30 Jul 2007
Posts: 372

PostPosted: Tue Jan 13, 2009 7:36 pm    Post subject: Reply with quote

HotKeyIt wrote:

Does it mean all options from www.pcre.org are working in AutoHotkey?

If I'm not mistaken, yes. At least the syntax. Also, I noticed AutoHotkey uses version 7.4 of the PCRE library (it's now up to 7.8 ). So there might be some features missing from what the PCRE manual says.
Back to top
View user's profile Send private message Visit poster's website
Slanter



Joined: 28 May 2008
Posts: 739
Location: Minnesota, USA

PostPosted: Tue Jan 13, 2009 8:48 pm    Post subject: Reply with quote

If anyone's interested I uploaded the quick reference guide from the PCRE 7.4 documentation to here. There's also a link to the complete .chm file. Note that whenever you use \P, \p or \X the ErrorLevel is set to "Compile error 45 at offset #: support for \P, \p, and \X has not been compiled". There may also be other things that are not supported.
_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
TheGood



Joined: 30 Jul 2007
Posts: 372

PostPosted: Tue Jan 13, 2009 9:49 pm    Post subject: Reply with quote

Slanter wrote:
If anyone's interested I uploaded the quick reference guide from the PCRE 7.4 documentation to here. There's also a link to the complete .chm file. Note that whenever you use \P, \p or \X the ErrorLevel is set to "Compile error 45 at offset #: support for \P, \p, and \X has not been compiled". There may also be other things that are not supported.


Great links! Thanks!
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 1994
Location: GERMANY

PostPosted: Wed Jan 14, 2009 10:51 am    Post subject: Reply with quote

Thanks a lot. Unfortunately chm does not work for me:

Internet Explorer wrote:
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4055
Location: Belgrade

PostPosted: Wed Jan 14, 2009 10:54 am    Post subject: Reply with quote

Thank you. I didn't know about this and I wanted it so bad too many times.... Very Happy
_________________
Back to top
View user's profile Send private message
TheGood



Joined: 30 Jul 2007
Posts: 372

PostPosted: Wed Jan 14, 2009 12:31 pm    Post subject: Reply with quote

HotKeyIt wrote:
Thanks a lot. Unfortunately chm does not work for me:

Internet Explorer wrote:
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.


RIght-click the file > Properties > Unblock
Back to top
View user's profile Send private message Visit poster's website
HotKeyIt



Joined: 18 Jun 2008
Posts: 1994
Location: GERMANY

PostPosted: Wed Jan 14, 2009 12:53 pm    Post subject: Reply with quote

TheGood wrote:
HotKeyIt wrote:
Thanks a lot. Unfortunately chm does not work for me:

Internet Explorer wrote:
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.


RIght-click the file > Properties > Unblock


Never seen this before Question
Thanks a lot, this should be distributed with AutoHotkey or be available as a separate download on the same page.
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Wade Hatler



Joined: 28 Sep 2004
Posts: 9

PostPosted: Sat Jan 31, 2009 4:53 pm    Post subject: Reply with quote

Thanks for the link you posted, but it's only one of the useful help pages. I downloaded the CHM file and extracted the two most useful pages and posted them at:
The two pages are linked internally, so you only really need a bookmark to the first.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group