Noam Postavsky <[email protected]>
writes:

> On Fri, Aug 22, 2014 at 6:01 PM, Thorsten Jolitz
> <[email protected]> wrote:
>> isn't the whole idea based on the fact that NUL chars should not appear
>> ever in non-binary files (ok, I just proved the contrary with my regexps
>
> Yeah, exactly. They shouldn't but they might anyway.
>
>> #+BEGIN_SRC emacs-lisp
>> (string-match "\\(\\(:?.\\|\n\\)+?\\)\\(world\\)" "hello \nworld")
>> (match-string 2 "hello \nworld")
>> #+END_SRC
>
> You have the ":?" flipped around, it should be "?:".

ups, of course, that was noise ... 

But - why is this not working as expected?

#+BEGIN_SRC emacs-lisp
(string-match "\\(.\\|\n\\)+?\\(world\\)" "hello \nworld")
(match-string 1 "hello \nworld")
#+END_SRC

#+results:
: 

#+BEGIN_SRC emacs-lisp
(string-match "\\(.\\|\n\\)+?\\(world\\)" "hello \nworld")
(match-string 2 "hello \nworld")
#+END_SRC

#+results:
: world

Either the regexp alternative isn't a group, then "world" should be
subgroup 1 like here

#+BEGIN_SRC emacs-lisp
(string-match "\\(?:.\\|\n\\)+?\\(world\\)" "hello \nworld")
(match-string 1 "hello \nworld")
#+END_SRC

#+results:
: world

or it is one, than it should have match data - or I'm overlooking
something obvious?

-- 
cheers,
Thorsten

-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to