Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CsScript suport C# ver
#3
Thanks for your help! 
I used chatgpt to change the previous code to C # 5, but still reported the same error,
Using linqpad5, the codes can be executed successfully

Error (RT) in Macro10:  0x80131600, 
    C#(13,74): error CS1061: 'System.Array' does not contain a definition for 'Skip' and no extension method 'Skip' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
    C#(31,81): error CS1061: 'System.Array' does not contain a definition for 'Concat' and no extension method 'Concat' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?).   



Macro Macro4
Code:
Copy      Help
_s=
;using System;
;using System.Linq;
;using System.Text.RegularExpressions;
;
;public class Program
;{
;;;;;public static void Main()
;;;;;{
;;;;;;;;;string s = "xzc abc(s \"(abc)\")); dfg()";
;;;;;;;;;string p = @"abc\(((?:(?>[^()]*)|\((?<Open>)|\)(?<-Open>))*(?(Open)(?!)))\)";
;;;;;;;;;string[] result = FindMatch(s, p);
;;;;;;;;;Console.WriteLine("Full match: {0}", result[0]);
;;;;;;;;;Console.WriteLine("Group matches: {0}", string.Join(", ", result.Skip(1)));
;;;;;}
;
;;;;;public static string[] FindMatch(string s, string pattern)
;;;;;{
;;;;;;;;;Match match = Regex.Match(s, pattern);
;;;;;;;;;string fullMatch = match.Value;
;
;;;;;;;;;string[] groupMatches = null;
;;;;;;;;;if (match.Groups.Count > 1)
;;;;;;;;;{
;;;;;;;;;;;;;groupMatches = new string[match.Groups.Count - 1];
;;;;;;;;;;;;;for (int i = 1; i < match.Groups.Count; i++)
;;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;;groupMatches[i - 1] = match.Groups[i].Value;
;;;;;;;;;;;;;}
;;;;;;;;;}
;
;;;;;;;;;return groupMatches == null ? new[] { fullMatch } : new[] { fullMatch }.Concat(groupMatches).ToArray();
;;;;;}
;}


str s=
;xzc abc(s \"(abc)\")); dfg()
str s2=
;abc\(((?:(?>[^()]*)|\((?<Open>)|\)(?<-Open>))*(?(Open)(?!)))\)

CsScript x.AddCode(_s)
out x.Call("Program.FindMatch" s s2)


Messages In This Thread
CsScript suport C# ver - by Davider - 05-01-2023, 04:48 PM
RE: CsScript suport C# ver - by Gintaras - 05-01-2023, 05:51 PM
RE: CsScript suport C# ver - by Davider - 05-01-2023, 11:11 PM
RE: CsScript suport C# ver - by Davider - 05-02-2023, 01:33 AM
RE: CsScript suport C# ver - by Gintaras - 05-02-2023, 04:42 AM
RE: CsScript suport C# ver - by Davider - 05-02-2023, 05:21 PM
RE: CsScript suport C# ver - by Gintaras - 05-02-2023, 05:39 PM
RE: CsScript suport C# ver - by Davider - 05-06-2023, 01:15 AM
RE: CsScript suport C# ver - by Gintaras - 05-06-2023, 04:28 AM
RE: CsScript suport C# ver - by Gintaras - 05-06-2023, 04:32 AM
RE: CsScript suport C# ver - by Davider - 05-06-2023, 09:13 AM
RE: CsScript suport C# ver - by Kevin - 05-06-2023, 12:42 PM
RE: CsScript suport C# ver - by Davider - 05-06-2023, 04:39 PM
RE: CsScript suport C# ver - by Davider - 05-08-2023, 01:37 AM
RE: CsScript suport C# ver - by Gintaras - 05-08-2023, 04:33 AM
RE: CsScript suport C# ver - by Davider - 05-08-2023, 05:27 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)