AutoHotkey Community

It is currently May 26th, 2012, 2:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: January 13th, 2009, 5:54 am 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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".


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 3:11 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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. :oops:

It would be really great to have a full Regex referrence in AutoHotkey help.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 8:36 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 9:48 pm 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 10:49 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 11:51 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 11:54 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Thank you. I didn't know about this and I wanted it so bad too many times.... :D

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 1:31 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 1:53 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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 :?:
Thanks a lot, this should be distributed with AutoHotkey or be available as a separate download on the same page.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 31st, 2009, 5:53 pm 
Offline

Joined: September 28th, 2004, 7:10 am
Posts: 17
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: DataLife and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group