| View previous topic :: View next topic |
| Author |
Message |
TheGood
Joined: 30 Jul 2007 Posts: 372
|
Posted: Tue Jan 13, 2009 4:54 am Post subject: AutoHotkey Help Manual - RegEx Quick Reference: Addition |
|
|
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 |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Tue Jan 13, 2009 2:11 pm Post subject: |
|
|
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.
It would be really great to have a full Regex referrence in AutoHotkey help. _________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 372
|
Posted: Tue Jan 13, 2009 7:36 pm Post subject: |
|
|
| 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 |
|
 |
Slanter
Joined: 28 May 2008 Posts: 739 Location: Minnesota, USA
|
Posted: Tue Jan 13, 2009 8:48 pm Post subject: |
|
|
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 |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 372
|
Posted: Tue Jan 13, 2009 9:49 pm Post subject: |
|
|
| 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 |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Wed Jan 14, 2009 10:51 am Post subject: |
|
|
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) |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4055 Location: Belgrade
|
Posted: Wed Jan 14, 2009 10:54 am Post subject: |
|
|
Thank you. I didn't know about this and I wanted it so bad too many times....  _________________
 |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 372
|
Posted: Wed Jan 14, 2009 12:31 pm Post subject: |
|
|
| 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 |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 1994 Location: GERMANY
|
Posted: Wed Jan 14, 2009 12:53 pm Post subject: |
|
|
| 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. _________________ AutoHotFile - ToolTip(n,text,title,options) |
|
| Back to top |
|
 |
Wade Hatler
Joined: 28 Sep 2004 Posts: 9
|
Posted: Sat Jan 31, 2009 4:53 pm Post subject: |
|
|
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 |
|
 |
|