anchor.diff:  'analyze-string'(Ctx,Input,Pattern0,Flags) ->
      Pattern = xqerl_types:string_value(Pattern0),
      Flags1 = xqerl_types:string_value(Flags),
  -   case xs_regex:compile(Pattern,Flags1) of
  +   case xs_regex:analyze(Pattern,Flags1) of
         {error, {invalid_flag, _}} ->
            ?dbg("invalid_flag",invalid_flag),
            ?err('FORX0001');
         {error, Err} ->
            ?dbg("Err",Err),
            ?err('FORX0002');
  -      {true,_} ->
  +      {true, _, _} ->
            ?dbg("true",true),
            ?err('FORX0003');
  -      {_,MP} ->
  +       {_, MP, Grps} ->
            Input1 = string_value(Input),
            Content = case re:run(Input1, MP, [global]) of
                         nomatch ->
  
positive.code:          xqerl_node:new_fragment(Ctx, Frag)
     end.
  
  analyze_string1([],String) -> % no matches
     #xqElementNode{name = #qname{namespace = ?NS,
                                  prefix = ?PX,
                                  local_name = ?A("non-match")},
                           content = ?str(String)};
  analyze_string1(List,String) ->
     Fun = 
       fun([{Start,End}|Groups],LastPos) ->
             Pre = if Start =/= LastPos ->
                         Slc = string:slice(String,LastPos,(Start-LastPos)),
                         [analyze_string1([],Slc)];
                      true ->
                         []
                   end,
             Matches = 
                case Groups of
                  [] ->
                     S = string:slice(String,Start,End),
                     #xqTextNode{string_value = ?str(S)};
                  _ ->
                     {B,_} = hd(Groups),
                     {Es,Ee} = hd(lists:reverse(Groups)),
                     GrpSize = Es+Ee,
                     Tail = if (Start + End) > GrpSize -> % missing tail text 
                                  Slc1 = string:slice(String,GrpSize,
                                                      Start + End - GrpSize),
                                  [#xqTextNode{string_value = ?str(Slc1)}];
                               true ->
                                  []
                            end,
                      if B > Start ->
                            S = string:slice(String,Start,Start + End - B),
                            [#xqTextNode{string_value = ?str(S)} |
                               get_groups(String,Groups,1)] ++ Tail;
                         true ->
                            get_groups(String,Groups,1) ++ Tail
                      end
                end,
             Match = #xqElementNode{name = #qname{namespace = ?NS,
                                                  prefix = ?PX,
  
negative.code:                    end,
           Expr = if Input1 == <<>> -> [];
                     true ->
                        analyze_string1(Content, Input1, Grps)
                  end,
           Frag = #xqElementNode{name = #qname{namespace = ?NS,
                                               prefix = ?PX,
  